Tuesday, February 23, 2010

Java still not supported (officially!) on Windows Vista

It may be a world known fact but I haven't known it yet that Java officially doesn't (officially) support Windows Vista yet

We have been working on a thick client implementation in Java Swing and RMI and while unit testing we figured out a JFileChooser cannot be invoked. It throws following error. This happened with JRE version 1.5.0_08-b03 and seems to have been correctted in JRE build version 1.5.0_18-b02

Further details are available on Sun's / Oracle's bug site: http://bugs.sun.com/view_bug.do?bug_id=6449933

An error stack trace is given below which might help you identify this issue precisely...
Hope this helps ...

******************* LAUNCHING APPLICATION **************
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
Starting Application...
16:42:45,076 SYSTEM - Application Started on port 52305...
7038 [Thread-2] INFO fasttrack - LOGCAT VERSION
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 3184
at sun.awt.shell.Win32ShellFolder2.getFileChooserIcon(Win32ShellFolder2.java:748)
at sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.java:248)
at sun.awt.shell.ShellFolder.get(ShellFolder.java:221)
at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$LazyWindowsIcon.createValue(WindowsLookAndFeel.java:1865)
at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:185)
at javax.swing.UIDefaults.get(UIDefaults.java:130)
at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44)
at javax.swing.UIDefaults.getIcon(UIDefaults.java:411)
at javax.swing.UIManager.getIcon(UIManager.java:613)
at javax.swing.plaf.basic.BasicFileChooserUI.installIcons(BasicFileChooserUI.java:237)
at javax.swing.plaf.basic.BasicFileChooserUI.installDefaults(BasicFileChooserUI.java:219)
at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:135)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(WindowsFileChooserUI.java:126)
at javax.swing.JComponent.setUI(JComponent.java:652)
at javax.swing.JFileChooser.updateUI(JFileChooser.java:1755)
at javax.swing.JFileChooser.setup(JFileChooser.java:366)
at javax.swing.JFileChooser.(JFileChooser.java:341)
at javax.swing.JFileChooser.(JFileChooser.java:300)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1778)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Sunday, February 21, 2010

Resetting password for System user in Oracle Express Edition

If you are running Oracle XE for your own development purpose and by any chance forgotten the password of the "system" user here are the simple steps to resolve the problem

Linux:
export ORACLE_SID=XE
export ORACLE_HOME=
sqlplus / as sysdba
SQL> alter user system identified by ;

Windows:
set ORACLE_SID=XE
set ORACLE_HOME= (E.g. This will look something like - "D:\oraclexe\app\oracle\product\10.2.0\server")
sqlplus / as sysdba
SQL> alter user system identified by ;

Hope this helps...

Wednesday, December 9, 2009

Ora-02429 cannot drop index used for enforcement of unique/primary key

There are multiple reasons why Ora-02429 error may happen. I encountered this problem while deleting tablespace dedicated to indexes in the product we are using.

One may want to try following options:

  1. Use "cascade constraints" e.g. drop tablespace [name of ts] cascade constraints;
  2. check what objects are in this tablespace and move these to some where else and drop the tablespace.
  3. alter index [indexname] rebuild [tablespacename]; (this is because, rowid's will change when a table is moved/re-org)
  4. If you are trying to delete tablespace which is still referenced by any user; you need to make sure either users are removed (recursively) and that there are no data related to any user in there. Delete the user (Schema) with all the objects and it should free up any references.

For me the last option worked!

Tuesday, December 8, 2009

Helpful SQL Scripts

There may come a time for database developers to perform bulk operations e.g. compile all the stored procedures or rebuild all the indices. This might be required esp. when you are supporting a product and have to upgrade it.

I had to do this with help of oracle XE instance with only a web interface and here is the solution I developed.

Recompiling All Procedures:

begin
declare
cursor c_proc is
select object_name from user_objects where object_type = 'PROCEDURE';
v_sql varchar2(512);

begin
for c_proc_rec in c_proc LOOP
v_sql := 'ALTER PROCEDURE 'c_proc_rec.object_name' COMPILE';
execute immediate v_sql;
END LOOP;

end;
end;


Rebuilding all indexes:
This might be required after inserting thousands of rows as part of product upgrade. Here is the script that I used.


begin
begin
declare
cursor c_idx is
select index_name from user_indexes where index_type = 'NORMAL' and uniqueness = 'NONUNIQUE';
v_sql varchar2(512);

begin
for c_idx_rec in c_idx LOOP
v_sql := 'Alter index 'c_idx_rec.index_name' rebuild';

execute immediate v_sql;
END LOOP;
end;
end;


Hope this helps!

Monday, December 7, 2009

Restarting a Windows XP when connected over Remote Desktop

If you ever have to connect to a windows machine over remote desktop and have to shut it down; it might not be straight forward to shutdown / restart the remote machine.

Here is a simple work around that I could find. Please note that the remote desktop program by design disables the shutdown option when connected.

"Shutdown" is the utility and can be invoked from command prompt. If you have access to command prompt - run the following command and you should see a dialoguebox displaying countdown to shutdown.

C:\>shutdown -s

please note that if you don't pass any arguments; the command will list all available parameters that "shutdown" utility can take as arguments.

Following command will restart the machine.

C:\>shutdown -r

Hope this helps...

Monday, November 30, 2009

Importance of Traceability

With the fast pace industry – it becomes imperative to understand how any change impacts you. I am sure most of us try to calculate this mentally and can narrate most of the impacts. In daily life we do this subconsciously and intuitively that seldom we notice this. And since humans perform the actions off of his brains – there is a chance of human error. The way to avoid the margin of error is to define a process. A process will be based on a methodology and guidelines that will help us derive outcomes which sometimes go overlooked and cause disasters.

In software world – methodology is what helps maintain a discipline. We were pitching in at a new client who is in the business of oil trading. They implemented complex trading system and the implementation was Rapid Application Development. A flip side of the implementation approach was that it sometimes overlooks the documentation. Documentation has been a secondary priority and in the process to keep showing progress, they are always neglected by developers, designers and testers.

Let’s think about a few scenarios:

  1. Sometimes a good project execution will ensure right amount of relevant documentation is in place but documents produced at the end of the project execution is voluminous enough to be unmanageable
  2. Sometimes the application will change hands between implementation and maintenance team. New people join team old people leave team and KT for a few hours during the hand off process is not sufficient enough to provide coverage for every document produced during implementation.
  3. Sometimes documentation is present but one needs to identify which is the area where the documentation is missing or can be improved.
  4. A new requirement is being introduced half way thru the implementation and one needs to determine where all places the change will impact and what all documentation will have to be changed
  5. Software upgrade is scheduled in 3rd year of implementation and impact analysis is required

Unless there is a map that leads from and links all the requirements to the configuration / implementation details – the task will become rather manual and time consuming and unreliable.

These pain points bring us to Traceability of change in an application. Traceability becomes all-the-more important once the application enters maintenance phase. There has to be a matrix which will explain the requirements and map it back to low level technical requirements, design, implementation, configuration artifacts associated with it including the coverage of QA on different environment.

I have noticed tremendous help a matrix like this provides to the Clients, maintenance team, the developers and testers.

Please feel free to get in touch if you need to learn more about traceability to me.

Tuesday, November 10, 2009

Mailbox Size in Corporate World - A Rant...

Advent of Data Centers, and Cloud Computing opens up a whole new infinite window of opportunity for IT Infrastructure. It liberates us from small time computing and space constraints. I still remember how we treasured the fact when Yahoo! Announced to increase the mailbox size from 25MB to 100MB in April 2004. Google Mail used to lead the bandwagon by providing 2 GB space. And then almost every tom dick and harry email provider offered unlimited mailbox size.

I wonder when the IT companies will start looking at ways and means to making this available to an average employee. I am constrained with 100MB storage on Exchange Server and there is no way I can retrieve emails older than 6 months unless... I keep taking backup manually. It becomes really frustrating when I have to search something that I sent last year to my clients. Taking a backup on my PC and synchronizing the emails with Laptop again is a big pain.

E-mails is the most critical means of running every day business. I wonder if putting a restriction on email box for people will *not* have an impact on business. Every time I miss an email / have to re-create information in my email; I end up wasting my precious time. Either that gets billed to the clients or makes me work long hours if I don’t want that to happen. Think about the magnitude of effort when 80,000 employees spending 15 minutes every day re-creating information in emails. It will be 20,000 man hours i.e. 2500 man days. And if we look at it from Cost perspective; (Assuming average pay of US $150 per person per day) it will be US $375000. Let’s assume we are supposed to find opportunity cost of this time spent by assuming Clients are charged US $65 per hour for 8 hours per person every day. It will total to US $1,550,000 (1.55 Mil) worth of revenues *Daily*!

You see, now it makes sense to you.

Wouldn’t it be great if IT companies who brag about setting trends in the industry pay a little attention to bring the change in their own organization?