Friday, February 29, 2008

Adorable AJAX

We are freshly brewing AJAX into our Java appliction. AJAX is widely used across the web lately. All major google apps like gmail,google maps, google suggest are based on AJAX. In short it makes the server calls seamless to the web user.

Summary of AJAX:




Thursday, February 21, 2008

Leader Vs Manager

For the first time,I heard it from my friend, who wanted to be a leader than a Manager.

It intrigued me.. what is a leader ..? what separates leader from a Manager...? Do we have to be a good manager to be a leader..??

In short the difference is:

Managers are people who do things right and leaders are people who do the right thing.

The difference may be summarized as activities of vision and judgment — effectiveness —versus activities of mastering routines — efficiency. The chart below indicates key words that further make the distinction between the two functions:

· The manager administers; the leader innovates.

· The manager is a copy; the leader is an original.

· The manager maintains; the leader develops.

· The manager accepts reality; the leader investigates it.

· The manager focuses on systems and structure; the leader focuses on people.

· The manager relies on control; the leader inspires trust.

· The manager has a short-range view; the leader has a long-range perspective.

· The manager asks how and when; the leader asks what and why.

· The manager has his or her eye always on the bottom line; the leader has his or her eye on the horizon.

· The manager imitates; the leader originates.

· The manager accepts the status quo; the leader challenges it.

· The manager is the classic good soldier; the leader is his or her own person.

· The manager does things right; the leader does the right thing.

The most dramatic differences between leaders and managers are found at the extremes: poor leaders are despots, while poor managers are bureaucrats in the worst sense of the word. Whilst leadership is a human process and management is a process of resource allocation, both have their place and managers must also perform as leaders. All first-class managers turn out to have quite a lot of leadership ability.


In a different perspective:

here is an article in Hindu News paper by B. S. RAGHAVAN

What are the qualities and capabilities of a leader as distinguished from those of a manager? Is there anything like leadership in and by itself, which differs from what is expected of a manager? Are the functions of the leader and manager distinct and separate?

Management tracts purposely pursue these enquiries. It is a truism that not all leaders are necessarily good managers and vice versa. It is equally clear that high designations alone do not help in delivering the goods. There is a view of Jawaharlal Nehru, for instance, that he was inspiring as a leader but fell short as the chief executive of the nation. Making a distinction between the attributes of a leader and a manager is a pointless pastime. Management pros, however, happily indulge in it. Some write-ups go to absurd lengths in viewing leader's role in isolation from that of the manager. One that I saw recently lets itself go with things like: Leaders inspire, managers measure; leaders guide, managers navigate; leaders talk, managers listen; leaders expect, managers demand; leaders support, managers teach; and similar inanities.

Actually, if a leader is one who inspires his associates to act in tune with his vision by setting an example in all that he expects in and of others, then every functionary who has been given a task to accomplish, whether called a manager or by any other name, has to be a leader as well.

Similarly, it is no use merely entertaining or propagating a vision and having impeccable credentials as a person unless they translate into achievements contributing to the goals of the organisation or the collective good of the society. Thus, the only reliable test of leadership is its ability to produce results commensurate with the efforts.

I think you have to be a good manager to be a good leader. Having the vision alone wont solve the purpose.. you should also know how to deliver effective results. :D

Tuesday, February 19, 2008

Access Database Tips and Tricks

I was supporting this dying application along with my other work on SRGT. Since RGC was dying. they wanted to decomission it and wanted me to develop a small vba application for users to be able to view the data.

grr.. I'll be glad to work in java but VBA is totally new to me.. so I am learning and posting what I learn here

for everyones ref incuding me :D

To show another Form from the current Form
DoCmd.OpenForm "frmEmployeeMain"

Form is accessed by ME
ie., to ref any form variable in access, use ME.


Passing variable from one Form to Another

syntax of accessing: Forms![formname]![fieldname]

Dim strSun As String

strSun = Forms!CustomeSearchForm!customerName

Showing an alert msg.

Alert msgs are great way to debug an app. Here is how to show 1 in access

yourMsg = MsgBox(strSun, 1, strEmpCount)

Creating welcome screen:

1) In your design window... go to tools --> Startup --> select the form / page you want to use for startup

2) You can also choose to hide the database window here.

When you have a welcome screen, press F11 to see the database window instantly


Wild card search with parameters:

uery parameter coming from another form : [Forms]![CustomeSearchForm]![customerName]

TO add wild card search to the above parameter just add "*" & [query params] &"*"

Like "*" & [Forms]![CustomeSearchForm]![customerName] & "*"

Equi Join vs OuterJoin

Instead of using equi join use the outer join to display all the data from table 1 though the
mapping information is missing in the child table or table 2.Just rt click on the join to change the join properties.

avoiding ghostly grey pages with graceful error messages.

Catching errors on page load.

Private Sub Form_Load()
On Error GoTo Err_search_Click

strSun = Me.id_rgc_customer

Exit_search_Click:
Exit Sub

Err_search_Click:

MsgBox "No Search Results Found. Please Refine Your Search."
DoCmd.Close

End Sub

Adding other tips I have learnt on printing and executing queries from access VBA

Close all other forms from an existing Form:
Just refer them by Form Name

DoCmd.Close acForm, "OldFormName"

But there is also an efficient way of doing it. I am just lazy but saw it one of my google searches y'day.

Executing Queries in Access VBA:

Dim db As DAO.Database

When you define your Database variable.. please make sure.. you append it with DAO.I did this stupid mistake of not adding DAO. yesterday and you can see my frustration
in my prev post.

Its just that Access defaults it to ADO and not DAO.. so I kept getting type mis match errors GRRRR.. I knew I passed by the hell y'day. SO DO NOT do the same mistake I did.

So being cautious define all ur Record sets etc.,

Dim db As DAO.Database
Dim facList As DAO.Recordset
Dim sptList As DAO.Recordset
Dim qryPar As DAO.QueryDef
Dim qrySpt As DAO.QueryDef

Next step is setting ur database to current database
Set db = CurrentDb
Set qrySpt = db.QueryDefs("myDefinedQry")


printRGCFacilityQuery is the query you must have defined in ur queries tab already

If your query takes input parameter.. set them here. If ur query expects i/p parms
and if u didnt set them already you will get too few parameters error.

'Set parameters

qrySpt.Parameters(0) = facList!fi_id_facility
qrySpt.Parameters(1) = Me.id_rgc_customer


'Execute Query
Set sptList = qrySpt.OpenRecordset


If (sptList.RecordCount > 0) Then

sptList.MoveFirst

Do Until facList.EOF

'Your Biz Logic goes here

End If
sptList.MoveNext
Loop

'Its always a good practice to close your connections after ur done w/ your processing.
qrySpt.Close
Set qrySpt = Nothing


Printing Other pages from the existing page:
'Open Form
DoCmd.OpenForm "printFacSupportForm", acPreview
'Print Form
DoCmd.RunCommand acCmdPrint
'Close Form
DoCmd.Close acForm, "printFacSupportForm"


'Open the form ur printing from

Me.Form.GoToPage 1



Happy Coding :D
-Sonu

Wednesday, January 30, 2008

Server, Cluster and Domain

Server: Well, we all know what a server is so lets talk abt Cluster and Domain :}

Cluster: A Server cluster consists of multiple server instances running simultaneously and working together to provide increased scalability and reliability

A cluster appears to clients to be a single Server instance.

Domain: A domain includes one or more Server instances, which can be clustered, non-clustered, or a combination of clustered and non-clustered instances. A domain can include multiple clusters. A domain also contains the application components deployed in the domain, and the resources and services required by those application components and the server instances in the domain. Examples of the resources and services used by applications and server instances include machine definitions, optional network channels, connectors, and startup classes.


In each domain, one Server instance acts as the Administration Server.—the server instance which configures, manages, and monitors all other server instances and resources in the domain. Each Administration Server manages one domain only. If a domain contains multiple clusters, each cluster in the domain has the same Administration Server.


you cannot "split" a cluster over multiple domains.Similarly, you cannot share a configured resource or subsystem between domains. For example, if you create a JDBC connection pool in one domain, you cannot use it with a server instance or cluster in another domain. (Instead, you must create a similar connection pool in the second domain.)


Benefits of Clustering:

Scalability
The capacity of an application deployed on a WebLogic Server cluster can be increased dynamically to meet demand. You can add server instances to a cluster without interruption of service—the application continues to run without impact to clients and end users.

High-Availability
In a WebLogic Server cluster, application processing can continue when a server instance fails. You "cluster" application components by deploying them on multiple server instances in the cluster—so, if a server instance on which a component is running fails, another server instance on which that component is deployed can continue application processing.

Capabilities of a Cluster

Failover: Using session replication and replica-aware stubs
Load Balancing

Objects that can be clustered

Servlets, JSPs ,EJBs ,Remote Method Invocation (RMI) objects ,Java Messaging Service(JMS) destinations ,Java Database Connectivity (JDBC) connections


Objects that cannot be clustered

File services ,Time services ,WebLogic Events (deprecated in WebLogic Server 6.0) ,Workspaces (deprecated in WebLogic Server 6.0)

Wednesday, January 23, 2008

Unix Commands.. SCP, TAR,GZIP etc

Creating a TAR file in Unix.

What is a TAR File..?

Tar is most commonly used pack/unpack program in unix. Used for packaging files be sent across machines in a network.

Use 'c' command to package tar and 'x' command to unpack tar

Ex: if you want to create a tarfile from files A B C.. here is the command

tar cf g.tar A B C

Note: Always make sure you specify the file name before specifying the file names. Or unix will over write the first file mentioned. ex:

tar cf A B C. File 'A' will be overwritten.

Options in Tar: 'c' : Create command
'v' displays/echos the files being archived
'f' is the file name.

Unpack a Tar File:

tar xf
tar xf g.tar

Compressing a tar file..

gzip and bzip are used to compress the tar file. Compressed tar file In many ways both reduce network transfer time and to save space on the disk.


Command to compress tar:

gzip g.tar

the file will be renamed g.tar.gz

saved a significant amount of time using gzip file compred to transferring regular tar file. took 2.14 mins using .gz format and ~7 mins using regular .tar.

Cut down my waiting/turn around time here... :)

to uncompress the gzip file use..

gzip -d g.tar.gz

will create a file called g.tar

and now to unpackage tar use

tar xc g.tar

yay ..!!!!! I did QA deployment today using all the commands..

SCP: Secure file transfer from one unix box to another.

What is SCP: Copies a single file or a folder with multiple files using secure protocol over TCP/IP (the network) from one computer to another

Syntax:

scp username@location of the remote server:path to be copied to

$ scp suneetha.sh sunny@cmcad54323:/cri_staging/omen/discovery/QA
Next line will prompt u for pwd

$ scp suneetha.sh sunny@cmcad54323:/cri_staging/omen/discovery/QA
sunny's Password:
Could not chdir to home directory /home/u496798: No such file or directory
suneetha.sh 100% |*****************************| 551 00:00

using regular FTP, you'll have to first copy the file to ur local and then copy to the other server..its a 2 step process. Using scp u can eliminate it and directly connect to remote server.. Its cool try it out sometime. :))

Happy Reading :)

Thursday, January 17, 2008

Bose-Einstein Condense

A Nobel prize in physics was awarded to 3 scientists(2 US n 1 German) in 2001 for achieving Bose-Einstein Condense, a theory since 70 years.

So what is Bose-Einstein Condense or a race for absolute zero, a program which I just saw in PBS Nova (inspired me to make a note in my blog)

In the quest to reach colder and colder temperatures, physicists in 1995 created a remarkable new form of matter—neither gas, nor liquid, nor solid—called a Bose-Einstein condensate (BEC). First envisioned by Albert Einstein and a young Indian physicist named Satyendra Bose in the 1920s (Proud to be an Indian moment more info at http://en.wikipedia.org/wiki/Satyendra_Nath_Bose), BECs reveal properties of quantum mechanics—their atoms seem to merge together and lose their individual identity, behaving less like discrete particles and more like waves. If you're having trouble picturing this, not to worry; even physicists who work with BECs find them mind-boggling. In this interview, Luis Orozco of the University of Maryland, College Park offers some metaphors to help us begin to comprehend BECs and get a grasp of research in the strange world of ultracold atoms.


As things start to move slower and slower you're able to look at them for extended periods of time. It is as if I were to ask you, "Could you tell me something about the handles of a car that is passing on a highway at 50 or 60 miles an hour?" Definitely you won't be able to say anything. But if the car is moving rather slowly, then you would be able to tell me, "Oh yes, the handle is this kind, that color, has these properties." Or: "There is no handle." And it's precisely that ability to interrogate the car—I am looking at the car for a long, long time—so I can get information out of it.

In the same sense, if we have cold atoms and they're moving very, very slowly, then I should be able to learn a lot and get information out of those atoms. I extend the time that they are available.

At room temperature an atom is moving at roughly 500 meters per second.Slowing down to absolute zero, the atoms start to move about 20 centimeters per second [about 0.45 mph].

Applications: 1) At this slow velocity, we can study the atoms much closer that we ever thought of like studying weak force in atoms

2) Coherence of atoms

3) Quantum computers.

Formatting Millisecond in Oracle Date

Had this weird problem today.. timestamp is stored into date field..and so there there is this extra 0 ... which is throwing an error if I am using regular oracle date formatting with to_date.

Sample dt stored in db: 1/5/2006 12:38:30.000 PM

expected date in to_date function is something like.. to_date('10/01/2007 00:00:00','MM/DD/YYYY HH24:MI:SS')

there is no 'SSS' which takes millisecond.

here is what I did. Process it first as to_char to eliminate the extra 0 in millisec and use it for ur date function.

to_date(to_char(PROPOSAL_CREATION_DATE,'MM/DD/YYYY HH24:MI:SS') ,'MM/DD/YYYY HH24:MI:SS')

here is a sample query to get all rows in a month

select * from table1 where to_date(to_char(CREATION_DATE,'MM/DD/YYYY HH24:MI:SS') ,'MM/DD/YYYY HH24:MI:SS') > to_date('10/01/2007 00:00:00','MM/DD/YYYY HH24:MI:SS')
and to_date(to_char(CREATION_DATE,'MM/DD/YYYY HH24:MI:SS') ,'MM/DD/YYYY HH24:MI:SS')<= to_date('11/01/2007 00:00:00','MM/DD/YYYY HH24:MI:SS')

it works perfectly well ..yay.. happy coding. :)