Mar 13 2008

Problem viewing Indic scripts on Firefox

Posted in Firefox, Liking on Thursday, March 13, 2008 at 15:49

It has been couples of weeks since my interest & love for mother tongue - Gujarati, is gaining momentum. Throughout my childhood literature has always attracted me. I took extra classes to learn Hindi & Sanskrit in depth. But as I got into higher grades pressure mounted to concentrate on chief subjects - Geometry, Trigonometry, Chemistry, Biology etc etc. And, the days came when I used to touch language subjects on exam days! The situation became worst during graduation & post graduation. I don’t recollect if during those 6 years I have read any other book - be it a poem compilation, novel, self-help, classics.

After so many years of hibernation, my deep liking for language has surfaced. Thanks to the “blog-world”. So many good “Gujju” blogs are floating around. It’s a real pleasure to read them. As I was going through them, I noticed that they are not being rendered properly on Mozilla browser - Firefox running on Windows XP Pro with SP2. When I tried with IE 6, it is working all fine. A quick search on net gave me the solution.

It is very simple -

  1. Go to Control Panel -> Regional & Language Options.
  2. Select “Languages” tab.
  3. Check the checkbox in front of “Install files for complex scripts and right-to-left languages [including Thai]”.
  4. A dialog box will po-up. Press OK.
  5. It will install some OS files and ask you to restart.

Bingo! You are done. For details you can check here.

No responses yet

Mar 07 2008

MS vs. Amazon?!

Posted in Database, Microsoft, Web Services on Friday, March 7, 2008 at 12:18

Computer world has witnessed Microsoft competing against many vendors across the market segments - from packaged softwares like web browser, OS & Office to these days hottest internet business. Now, it is entering into new race with Amazon by launching SSDS [SQL Server Data Service].

SSDS is in line to Amazon’s SimpleDB. Although as of now both services are offered as beta, but Amazon has visible advantage being first in the fray.

IMO, below will decide the WINNER -

  • Availability of Service
  • Data Security & Manageability
  • Performance
  • Data Access Model

I’m still wondering why DB giant - Oracle is keeping the distance? I think IBM too can join this race anytime! Please excuse me if I have missed their announcements. ;)

Surely, couple of next quarters would be very interesting to watch in these space.

No responses yet

Feb 28 2008

Database in new Avatar

Posted in Database, Web Services on Thursday, February 28, 2008 at 15:20

SaaS - Software as a Service. If you have anything to do with information technology, you must have heard this buzzword. Industry leaders are talking about it for a while and there are some success stories as well.

I heard about it for the first time when I was with Oracle, way back in 2004-05. They have coined Oracle On Demand. Wherein, Oracle used to host & manage database instances for their customers. But it wasn’t ideal implementation of SaaS as customers need to shell out license cost for instances irrespective of its hosting environment and usage.

But, Amazon has given new paradigm to it with its SimpleDB. It’s a web service for executing queries on structured data stored in Amazon hosted environment. What amuse me is not executing query by invoking web service, but innovation they brought in for storage structure. The data will be stored in domains, like excel spread-sheets. This will yield more flexibility as you need not pre-define all data points. You can easily add new attributes as and when it is required. The newly added attributes will be automatically indexed in real time.

You can read more on it and host of related services at AWS

One response so far

Feb 27 2008

Making References unusable

Posted in Java on Wednesday, February 27, 2008 at 15:10

An interesting problem at theserverside.com

If I can comprehend the issue -
You have two or more handles to same object and you want to enforce that no references should use the object, if it was “flushed” by any of the reference during execution.

Proposed Solution
For the given object implement destroy() that will update member variables marking them unusable for next set of execution. We can set some of them to null or introduce a flag that will represent status of the object. Now, the status code will decide, if a method should be executed or a reference should be set to null.

Here is example code…

import java.util.List;
import java.util.ArrayList;

public class TestDestroy
{
	public static void main(String ar[])
	{
		TestObj obj1 = new TestObj(100,true);
		TestObj obj2 = obj1;

		TestObj obj3 = new TestObj(200,true);

		List<TestObj> testObjs = new ArrayList<TestObj>();
		testObjs.add(obj1);
		testObjs.add(obj2);
		testObjs.add(obj3);

		// before destroy
		System.out.println("before destroy...");
		System.out.println("obj1 = "+obj1);
		System.out.println("obj2 = "+obj2);
		for(int i=0;i<testObjs.size();i++)
		{
			TestObj obj = (TestObj)testObjs.get(i);
			System.out.println("obj<"+i+"> = "+obj);
		}

		// destroying obj1
		obj1.destroy();

		// after destroy
		System.out.println("after destroy...");
		System.out.println("obj1 = "+obj1);
		System.out.println("obj2 = "+obj2);
		for(int i=0;i<testObjs.size();i++)
		{
			TestObj obj = (TestObj)testObjs.get(i);
			System.out.println("obj<"+i+"> = "+obj);
		}
	}
}

class TestObj
{
	private int i = -1;
	private boolean isLive = false;

	public TestObj(int i, boolean isLive)
	{
		this.i = i;
		this.isLive = isLive;
	}

	public void destroy()
	{
		this.i = -1;
		this.isLive = false;
	}

	public String toString()
	{
		if(this.isLive)
			return "[ i="+this.i+", isLive="+this.isLive+"]";
		else
			return null;
	}
}

This example may look trivial but we can extend the same idea to implement other methods in given object. For example, we have display() that formats the object data with HTML tags so it can be displayed in any HTML browser. So, our code would look like…

public String display()
{
	if(!this.isLive)
	{
		throw new NullPointerException("Object is set to null by other reference");
	}
	else
	{
		String html = null;

		// code to convert object into HTML representation

		return html;
	}
}

No responses yet

Feb 22 2008

First Learning on Agile

Posted in Agile on Friday, February 22, 2008 at 5:58

Last week I stumble upon a good podcast on Agile Methodologies by V. Subramaniam. I discovered some facts and apprehended few thoughts from it.

Facts about Software Projects:

  • Only 7% features developed as part of software product are used by end user. It may give bitter feelings to developers, but it is fact. How many features of MS Word or Excel we are using while working with it on daily basis?
  • Approximately 10% of software projects are successful where success is measured in terms of project being delivered on time, in budget and with reasonable functionality.

How should we tackle it?

If you build what customer wants, you will fail. You need to build what customer will need in future. Think about a scenario where you have recently finished your requirement gathering phase and planning for a huge project delivery due after a year. Through out the year, your team is busy in developing features that customer has cited. After a year when you go back to customer with your product, you would be shocked when customer comments that he may not be interested in couple of features now, aligning their requirements to current market needs. At times, it would be bit frustrating too, if you have become passionate about a feature that you developed skillfully, but it would never see daylight?!

So the question comes, how to gauge what customer may like to see in future releases? The idea is very simple - talk to your customer frequently. You can shorten the time between requirement gathering and customer feedback. Try to collect feedback by showing demo of the application [and not a prototype application].

How Agile Methodology helps?

“Agile Manifesto” says -

  • Individuals and interactions over processes and tools.
  • Working software over comprehensive documentation.
  • Customer collaboration over contract negotiation.
  • Responding to change over following a plan.

Here, the implementation of first phrase does not happen at the sacrifice of the later one. For example, “Working software over comprehensive documentation” does not mean that we 100% overlook the documentation. But it does mean that we don’t want to follow it as strictly as we are doing as part of RUP.

We should implement “Pair Programming” [where one writes code, other thinks about test cases and logic] to promote interactions between developers. I had been working in similar environment some 6-8 moths back. Although at that time, I was not aware about pair programming. But thinking about it now, make me realize that it was quite effective and we developed very stable and scalable framework on which our software product is banking on!

As the last point in manifesto suggest, if we want to respond to change effectively, we should be checking ground reality often, a kind of adaptive planning. It would be a better idea to migrate the development process to an environment where continuous integration, testing & refactoring can be facilitate easily.

“Scrum” is the integral part of “Agile” way of software development. Scrum meetings are, usually, short [approx 10-15 mins], round table, stand up meetings. Participants should be discussing on,

  • What did I work on yesterday or last couple of days [if we are not having scrum meetings everyday]?
  • What am I going to work on tomorrow of next couple of days?
  • What is holding me back?

As it is apparent from the agenda, it would facilitate knowledge sharing. At times, it would help developer sought a faster solution to a problem, by taking a help of his peer who had solved similar problem in past or who carries good experience in that problem domain.

It has another two important concepts – “Sprint” and “Backlog”. Sprint cycles are typical development cycles that spans around 30 days. “Backlog” helps in measuring amount of efforts that needed to finish application in terms of time.

Flip side

Software development using agile methodology may succeed well, if team is competent enough.

Scrum meetings are meant to be short lived. If people start dragging on their status updates, it would result in lost of efforts. Ideally, we should start on time and scrum master should keep a tap on time. Moreover, member’s attitude matters a lot.

Usually, we tend to forget the importance of retrospection. It is highly important that we have some time spend in retrospection between two spring cycles.

Some punch lines…

  • Do not let your customer decide all three - Quality, Scope and Time. If he decides them, you are left with only one option – Failure.
  • A fool with a tool is a dangerous fool!
  • It’s not the tool, it’s the individual [craftsman] who makes the difference.

No responses yet

Feb 17 2008

Debugging JSF application

Posted in JSF on Sunday, February 17, 2008 at 7:00

I was looking for better approaches to debug my JSF application. I found, a good tool [of course, it is open-source :) ]!

It’s called - FacesTrace. The tool [or should I say library] is really helpful. It can provide you information on JSF life-cycle phases. It also provides performance-centric data - how much time it took in each phase, how many objects are there in different scopes.

The best part is its configuration. It is damn easy. If you are running JSF based application, it is ONLY three steps:

  1. Download FacesTrace and include in your web application libraries.
  2. Include taglib resource to your JSF source file.
    <%@ taglib uri=”http://sourceforge.net/projects/facestrace” prefix=”ft”%>
  3. Add following line to your JSF page to view data.
    <ft:trace />

Done! Launch the JSF page from your favorite browser and you should be able to see something like this at the bottom of your page:

FacesTrace

It is still in the inception phase [as the current version is 0.8.1]. I hope it matures with time!

3 responses so far

Feb 16 2008

Is Java re-inventing the WHEEL?

Posted in Java on Saturday, February 16, 2008 at 7:21

I was browsing the internet for some information and I stumbled upon this beautiful quote @ http://horstmann.com/

1980: C

printf("%10.2f", x);

1988: C++

cout << setw(10) << setprecision(2) << showpoint << x;

1996: Java

java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++)
	System.out.print(’ ‘);
System.out.print(s);

2004: Java

System.out.printf("%10.2f", x);

Now, what does that mean? Isn’t it look like re-inventing the printf?

No responses yet

Feb 13 2008

StringBuffer vs. StringBuilder

Posted in Java on Wednesday, February 13, 2008 at 12:57

Can you predict the output of following snippet:

public class StringTest
{
	public static void main(String ar[])
	{
		StringBuffer sb1 = new StringBuffer(”neo”);
		StringBuffer sb2 = new StringBuffer(”neo”);
		StringBuilder sbld1 = new StringBuilder(”neo”);
		StringBuilder sbld2 = new StringBuilder(”neo”);
		String str = new String(”neo”); 		

		if(sb1.equals(sb2))
			System.out.println(”Both StringBuffers are Equal”);
		else
			System.out.println(”Both StringBuffers are not Equal”);

		if(sbld1.equals(sbld2))
			System.out.println(”Both StringBuilders are Equal”);
		else
			System.out.println(”Both StringBuilders are not Equal”);

		if(str.equals(sb1))
			System.out.println(”String and StringBuffer are Equal”);
		else
			System.out.println(”String and StringBuffer are not Equal”);

		if(str.equals(sb1.toString()))
			System.out.println(”Now…String and StringBuffer are Equal”);
		else
			System.out.println(”Now…String and StringBuffer are not Equal”);
	}
}

If you are thinking it should print the message that is part of if block by evaluating equals() to true, you would be surprised to know the results.

Except the last condition, it evaluates all others as false and it will print “… are not Equal”. Now, looking at the results you may be doubting the implementation of equals() in StringBuffer and StringBuilder. Yes, you are thinking in right direction. Neither of them overrides equals() of Object.

To make it work, one needs to invoke toString() on StringBuffer and StringBuilder objects and then use equals() to compare string representation. It is bit clumsy way to check equality of StringBuffer and StringBuilder objects. I really didn’t understand the rationale behind it.

On the different note, the difference between StringBuffer and StringBuilder is that of thread safety. StringBuffer is thread-safe implementation of mutable sequence of characters. Where as, StringBuilder is not thread-safe. Needless to say that it would be a better idea to use StringBuilder instead of StringBuffer in Java application where objects are created locally [in a certain block of code]. For example, I have been using StringBuffer to produce toString() representation of various objects. I can surely make my program run faster by few milliseconds by replacing StringBuffer with StringBuilder objects [provided toString() is being called significant numbers of times].

No responses yet

Feb 04 2008

context(WFProcessInstance.createInstance)null

Posted in BPM, Savvion on Monday, February 4, 2008 at 14:50

I encountered following error when I was trying to instantiate a process deployed on SBM 6.5 SP2 [Savvion Business Manager] using external stub.

java.rmi.RemoteException: com.tdiinc.BizLogic.Server.PAKException: javax.ejb.TransactionRolledbackLocalException: com.savvion.sbm.bizlogic.util.BizLogicException: (520):Process Instance can not be created for <AssetMgmt_V2>!; context(WFProcessInstance.createInstance)null

As it was crying about context null, I thought I was missing on providing some context data while initializing dataslot values. I was able to create process instance successfully, if I was not passing dataslot values.

Going through tutorial or API documentation didn’t help much. I started with trial-n-error approach to pin down the problem. After few tries I arrived at the solution. :-) If I pass values for dataslots with String data type it works all well. The moment I uncomment the code to provide value for Number & Date data type, it bounces with above mentioned error. I am sure you will agree with me that the error message is highly obscured. Instead of putting context null as error-message they would have flashed incompatible data type for so-and-so data type(s). That would have been more helpful in debugging!

Any ways, the final solution was too provide values for Number data type as java.lang.Long, as I declared them LONG under storage tab of dataslot properties. Whereas, for Date type one need to supply object of com.savvion.sbm.bizlogic.server.svo.DateTime. One more surprise, right? I don’t understand why can’t they accept it as java.util.Date? In fact, I noticed that few API for setting process due date takes date value as either java.lang.String that should be valid for java.util.Date.parse(), or long that is time represented in milliseconds. I do understand the advantage of overloaded API but at times it leads to confusion, especially, when it is not documented well.

BTW, does any body know why they accept Date type in Savvion specific object - DateTime? Or is it just a bad design [not well-thought]?

One response so far

Jan 28 2008

Flashback Table

Posted in Database, Oracle on Monday, January 28, 2008 at 17:55

All the years I learned that DDL statements in RDBMS world are irrevocable. Once you drop a table it’s just gone; you can’t get that data back easily!

But that isn’t true anymore. “Flashback Tables” in Oracle 10g is at our rescue. Oracle 10g has got similar idea of our recycle-bin. When you execute a drop table statement it drops a table and moves it to recycle-bin, giving you a second chance to survive by restoring it if you have accidentally dropped it. Isn’t that really fantastic!

You can read more on that here. Now execute “drop table” statement without any sweat. :)

No responses yet

Next »