Thursday, October 22, 2009

Best Software Utilities (Non-IT) List

Here's a list of my favourite, eternally useful list of extremely useful Software Utilities / Tools.

It will be a Forever Updated post, with new additions regularly for Windows - obviously with a slight preference to Java + Open-source versions if competing apps are similar.
For Best Developer Utilities, see this earlier post, Must have tools for the Smart Java Professional.

If an app replaces an existing one, or if there are close seconds, the losing app will move to the Best Software Utilities (non-IT) Honour List.

Find out whats eating your Hard Disk space
WinDirStat: Gives a very unique visual categorization of which files and folders contain what. OpenSource, Windows
FolderSize: A quick way to analyse your usage but without advanced features. Freeware, Windows
JDiskReport: A Java-based disk analyser. Freeware, Java

Recover Lost Files
NTFS Undelete: Free software ported from the open-source Unix version of ntfs undelete utility. EXCELLENT! OpenSource, Windows

Watch any video format without installing codecs
VLC media player: Free all-in-one media player that plays every video format out there without additional codecs OpenSource, Windows

Tuesday, July 14, 2009

Error in Tolven RC1 configPhase3 - ORA-00932

Running configPhase3.bat of Tolven RC1 (with Windows-OpenLdap/Oracle10g/Jboss) was causing errors.

The command prompt showed:
C:\tolven\tolven-RC1\bin>configPhase3.bat
0 [main] INFO root - Start log4j - Configuration: file:/C:/tolven/tolven-RC1/bi
n/tolven-log4j.xml, logFileName: C:\tolven\tolven-RC1\log\tolven.log
18:29:07,570 INFO [TPFBoot] Loaded configDir C:\tolven\tolven-config
18:29:07,695 INFO [TPFBoot] Generated boot.properties: C:\DOCUME~1\sachin\LOC
ALS~1\Temp\tpf_7376485784350116145_boot.properties
18:29:07,757 INFO [TolvenApplicationInitializer] logging system initialized
18:29:07,757 INFO [TolvenApplicationInitializer] application root is C:\tolven\
tolven-RC1\bin
18:29:08,023 INFO [PluginRegistryImpl] configured, stopOnError=true, isValidati
ng=false
18:29:08,132 INFO [ShadingPathResolver] configured, shadow folder is C:\tolven\
tolven-config\build\temp\.jpf-shadow
18:29:08,757 INFO [PluginRegistryImpl] plug-in and fragment descriptors registe
red - 117
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.library.jasperreports-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/o
rg.tolven.library.jasperreports-0.0.1.zip for {PluginFragment: uid=org.tolven.li
brary.jasperreports@0.0.1} with key org.tolven.library.jasperreports
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.jboss.oracle-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/
org.tolven.assembler.jboss.oracle-0.0.1.zip for {PluginFragment: uid=org.tolven.
assembler.jboss.oracle@0.0.1} with key org.tolven.assembler.jboss.oracle
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.library.jboss-0.0.1.zip has been rep
laced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tolve
n.library.jboss-0.0.1.zip for {PluginFragment: uid=org.tolven.library.jboss@0.0.
1} with key org.tolven.library.jboss
18:29:08,804 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.jboss-0.0.2.zip has been r
eplaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tol
ven.assembler.jboss-0.0.2.zip for {PluginFragment: uid=org.tolven.assembler.jbos
s@0.0.1} with key org.tolven.assembler.jboss
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.deploy.source-0.0.2.zip has been rep
laced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tolve
n.deploy.source-0.0.2.zip for {PluginFragment: uid=org.tolven.deploy.source@0.0.
1} with key org.tolven.deploy.source
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.oracle.persistencexml-0.0.
1.zip has been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime
/plugins/org.tolven.assembler.oracle.persistencexml-0.0.1.zip for {PluginFragmen
t: uid=org.tolven.assembler.oracle.persistencexml@0.0.1} with key org.tolven.ass
embler.oracle.persistencexml
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.component.oracle.init-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/o
rg.tolven.component.oracle.init-0.0.1.zip for {PluginFragment: uid=org.tolven.co
mponent.oracle.init@0.0.1} with key org.tolven.component.oracle.init
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.deploy.jboss-0.0.3.zip has been repl
aced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/org.tolven
.deploy.jboss-0.0.3.zip for {PluginFragment: uid=org.tolven.deploy.jboss@0.0.1}
with key org.tolven.deploy.jboss
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.component.application.oracle.indexes
-0.0.1.zip has been replaced with new file:/C:/tolven/tolven-config/repositoryRu
ntime/plugins/org.tolven.component.application.oracle.indexes-0.0.1.zip for {Plu
ginFragment: uid=org.tolven.component.application.oracle.indexes@0.0.1} with key
org.tolven.component.application.oracle.indexes
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.assembler.oracle.orm-0.0.1.zip has b
een replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/or
g.tolven.assembler.oracle.orm-0.0.1.zip for {PluginFragment: uid=org.tolven.asse
mbler.oracle.orm@0.0.1} with key org.tolven.assembler.oracle.orm
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.component.application.jboss-0.0.1.zi
p has been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plu
gins/org.tolven.component.application.jboss-0.0.1.zip for {PluginFragment: uid=o
rg.tolven.component.application.jboss@0.0.1} with key org.tolven.component.appli
cation.jboss
18:29:08,820 WARN [ShadingPathResolver] old context URL file:/C:/tolven/tolven-
config/repositoryRuntime/plugins/org.tolven.deploy.pluginframework-0.0.1.zip has
been replaced with new file:/C:/tolven/tolven-config/repositoryRuntime/plugins/
org.tolven.deploy.pluginframework-0.0.1.zip for {PluginFragment: uid=org.tolven.
deploy.pluginframework@0.0.1} with key org.tolven.deploy.pluginframework
18:29:08,929 INFO [TolvenApplicationInitializer] integrity check done: errors -
0, warnings - 0
18:29:08,929 INFO [TolvenApplicationInitializer] application plug-in is org.tol
ven.command
18:29:08,929 INFO [StandardPluginManager] plug-in started - org.tolven.library.
pluginframework@0.0.1 (active/total: 1 of 105)
18:29:08,929 INFO [StandardPluginManager] plug-in started - org.tolven.library.
serverconfig@0.0.2 (active/total: 2 of 105)
18:29:08,945 INFO [StandardPluginManager] plug-in started - org.tolven.command@
0.0.3 (active/total: 3 of 105)
18:29:08,945 INFO [StandardPluginManager] plug-in started - org.tolven.config.d
atabase@0.0.1 (active/total: 4 of 105)
18:29:08,960 INFO [StandardPluginManager] plug-in started - org.tolven.library.
bouncy-castle@0.0.1 (active/total: 5 of 105)
18:29:08,960 INFO [StandardPluginManager] plug-in started - org.tolven.config.l
dap@0.0.1 (active/total: 6 of 105)
18:29:08,976 INFO [AdminAssembler] *** start ***
18:29:09,179 INFO [AdminAssembler] tmpDir - c:\tolven\tolven-config\build\repos
itoryTmp
18:29:09,179 INFO [AdminAssembler] stageDir - c:\tolven\tolven-config\build\rep
ositoryStage
18:29:09,179 INFO [AdminAssembler] devLib - c:\tolven\tolven-config\devLib
18:29:09,195 INFO [AdminAssembler] Admin keystore: c:\tolven\tolven-config\cred
entials\admin\tolvendev-admin.jks
18:29:09,195 INFO [AdminAssembler] Admin truststore: c:\tolven\tolven-config\cr
edentials\admin\tolvendev-admin-cacerts.jks
18:29:09,210 INFO [AdminAssembler] Admin secretkey: c:\tolven\tolven-config\cre
dentials\admin\admin-encryptedSecretKey
18:29:09,210 INFO [AdminAssembler] Admin password store: c:\tolven\tolven-confi
g\credentials\admin\admin-password.cfg
18:29:09,804 INFO [AdminAssembler] LDAP key: c:\tolven\tolven-config\credential
s\ldap\tolvendev-ldap-key.pem
18:29:09,804 INFO [AdminAssembler] LDAP certificate: c:\tolven\tolven-config\cr
edentials\ldap\tolvendev-ldap-cert.pem
18:29:09,804 INFO [AdminAssembler] LDAP truststore: c:\tolven\tolven-config\cre
dentials\ldap\tolvendev-ldap-cacerts.pem
18:29:09,804 INFO [AdminAssembler] LDAPClient key: c:\tolven\tolven-config\cred
entials\ldapclient\tolvendev-ldapclient-key.pem
18:29:09,820 INFO [AdminAssembler] Database keystore: c:\tolven\tolven-config\c
redentials\oracle\tolvendev-oracle.jks
18:29:09,820 INFO [AdminAssembler] Database truststore: c:\tolven\tolven-config
\credentials\oracle\root.crt
18:29:09,835 INFO [AdminAssembler] DatabaseClient key: c:\tolven\tolven-config\
credentials\pgadmin\postgresql.key
18:29:09,835 INFO [AdminAssembler] DatabaseClient certificate: c:\tolven\tolven
-config\credentials\pgadmin\postgresql.crt
18:29:09,851 INFO [AdminAssembler] AppServer keystore: c:\tolven\tolven-config\
credentials\jboss\tolvendev-jboss.jks
18:29:09,851 INFO [AdminAssembler] AppServer truststore: c:\tolven\tolven-confi
g\credentials\jboss\tolvendev-jboss-cacerts.jks
18:29:09,851 INFO [AdminAssembler] MDBUser key: c:\tolven\tolven-config\credent
ials\mdbuser\tolvendev-mdbuser-key.pem
18:29:09,867 INFO [AdminAssembler] MDBUser certificate: c:\tolven\tolven-config
\credentials\mdbuser\tolvendev-mdbuser-cert.pem
18:29:09,867 INFO [AdminAssembler] MDBUser keystore: c:\tolven\tolven-config\cr
edentials\mdbuser\tolvendev-mdbuser.p12
18:29:10,164 INFO [TolvenConfigWrapper] Load JSSE keystore for admin
18:29:10,164 INFO [TolvenConfigWrapper] Load JSSE truststore for admin
18:29:10,164 INFO [AdminAssembler] *** end ***
18:29:10,164 INFO [StandardPluginManager] plug-in started - org.tolven.assemble
r.admin@0.0.4 (active/total: 7 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
jasperreports@0.0.1 (active/total: 8 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
remoteclient@0.0.1 (active/total: 9 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
jboss@0.0.1 (active/total: 10 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
tolvenclient@0.0.2 (active/total: 11 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
javaee@0.0.1 (active/total: 12 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.library.
jdbcdriver@0.0.1 (active/total: 13 of 105)
18:29:10,179 INFO [StandardPluginManager] plug-in started - org.tolven.componen
t.application.jboss@0.0.1 (active/total: 14 of 105)
18:29:10,195 INFO [StandardPluginManager] plug-in started - org.tolven.library.
application@0.0.1 (active/total: 15 of 105)
18:29:10,257 INFO [Application] *** start ***
18:29:10,273 INFO [Application] Starting for user: admin to jnp://localhost:109
9
18:29:10,429 INFO [Application] Update MDBUser mdbuser
18:29:10,429 INFO [TolvenClient] jndi: java.naming.provider.url=jnp://localhost
:1099
18:29:10,429 INFO [TolvenClient] jndi: java.naming.factory.initial=org.jboss.na
ming.NamingContextFactory
18:29:10,429 INFO [TolvenClient] jndi: java.naming.factory.url.pkgs=org.jboss.n
aming:org.jnp.interfaces
18:29:11,523 INFO [LoadMDBUsers] Rolling back transaction : load mdbuser for: a
dmin
Application start failed.
org.java.plugin.PluginLifecycleException: can't start plug-in org.tolven.compone
nt.application@0.0.1
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:415)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:245)
at org.tolven.command.TolvenApplication.startRequiredPlugins(TolvenAppli
cation.java:87)
at org.tolven.command.TolvenApplication.startApplication(TolvenApplicati
on.java:56)
at org.java.plugin.boot.Boot.boot(Boot.java:346)
at org.java.plugin.boot.Boot.main(Boot.java:243)
at org.tolven.plugin.boot.TPFBoot.main(TPFBoot.java:102)
Caused by: java.lang.RuntimeException: Could not load mdbuser for: admin
at org.tolven.client.load.LoadMDBUsers.updateMDBUser(LoadMDBUsers.java:3
0)
at org.tolven.component.application.Application.updateMDBUser(Applicatio
n.java:152)
at org.tolven.component.application.Application.doStart(Application.java
:123)
at org.java.plugin.Plugin.start(Plugin.java:82)
at org.java.plugin.PluginManager.startPlugin(PluginManager.java:325)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:407)
... 6 more
Caused by: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.
SQLGrammarException: could not execute query
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)

at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInt
erceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(Stateles
sInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(R
oleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(Role
BasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
ntainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRem
otingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(Se
rverThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
ava:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
a:166)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGr
ammarException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException
(AbstractEntityManagerImpl.java:629)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
at org.tolven.security.bean.LoginBean.findUser(LoginBean.java:73)
at org.tolven.security.bean.LoginBean.createOrUpdateUser(LoginBean.java:
314)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationCo
ntextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3Int
erceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invok
e(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsI
nterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInt
erceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(Stateles
sInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(R
oleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(Role
BasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
ntainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRem
otingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(Se
rverThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
ava:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
a:166)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientI
nvoker.java:163)
at org.jboss.remoting.Client.invoke(Client.java:1634)
at org.jboss.remoting.Client.invoke(Client.java:548)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
eInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
opagationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
lientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
roxy.java:107)
at $Proxy19.createOrUpdateUser(Unknown Source)
at org.tolven.client.load.LoadMDBUsers.updateMDBUser(LoadMDBUsers.java:2
5)
at org.tolven.component.application.Application.updateMDBUser(Applicatio
n.java:152)
at org.tolven.component.application.Application.doStart(Application.java
:123)
at org.java.plugin.Plugin.start(Plugin.java:82)
at org.java.plugin.PluginManager.startPlugin(PluginManager.java:325)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:407)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:245)
at org.tolven.command.TolvenApplication.startRequiredPlugins(TolvenAppli
cation.java:87)
at org.tolven.command.TolvenApplication.startApplication(TolvenApplicati
on.java:56)
at org.java.plugin.boot.Boot.boot(Boot.java:346)
at org.java.plugin.boot.Boot.main(Boot.java:243)
at org.tolven.plugin.boot.TPFBoot.main(TPFBoot.java:102)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
eInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
opagationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
lientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
roxy.java:107)
at $Proxy19.createOrUpdateUser(Unknown Source)
at org.tolven.client.load.LoadMDBUsers.updateMDBUser(LoadMDBUsers.java:2
5)
at org.tolven.component.application.Application.updateMDBUser(Applicatio
n.java:152)
at org.tolven.component.application.Application.doStart(Application.java
:123)
at org.java.plugin.Plugin.start(Plugin.java:82)
at org.java.plugin.PluginManager.startPlugin(PluginManager.java:325)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:407)
at org.java.plugin.standard.StandardPluginManager.activatePlugin(Standar
dPluginManager.java:245)
at org.tolven.command.TolvenApplication.startRequiredPlugins(TolvenAppli
cation.java:87)
at org.tolven.command.TolvenApplication.startApplication(TolvenApplicati
on.java:56)
at org.java.plugin.boot.Boot.boot(Boot.java:346)
at org.java.plugin.boot.Boot.main(Boot.java:243)
at org.tolven.plugin.boot.TPFBoot.main(TPFBoot.java:102)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.ja
va:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java
:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
at org.tolven.security.bean.LoginBean.findUser(LoginBean.java:73)
at org.tolven.security.bean.LoginBean.createOrUpdateUser(LoginBean.java:
314)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationCo
ntextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3Int
erceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invok
e(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsI
nterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInt
erceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(Stateles
sInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(R
oleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(Role
BasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
ationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
enticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
ptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
usInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
ntainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRem
otingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(Se
rverThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
ava:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
a:166)
Caused by: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected -
got BLOB

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.
java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPrepare
dStatement.java:810)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStateme
nt.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPrepa
redStatement.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1134)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrep
aredStatement.java:3339)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
dStatement.java:3384)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery
(WrappedPreparedStatement.java:236)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:
186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 46 more
Press any key to continue . . .


And the JBoss Server logs showed:
2009-07-07 18:29:11,398 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 932, SQLState: 42000
2009-07-07 18:29:11,398 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00932: inconsistent datatypes: expected - got BLOB


After enabling full DEBUG logging for JBoss server AND Hibernate, the problem was identified as an incorrect SQL Query (see ORA-00932: inconsistent datatypes: expected - got BLOB)!

The basic problem was a wrong SQL query formed by Hibernate - the TOLVENUSER table has 3 columns of type BLOB and the query in question was "SELECT DISTINCT...". Whereas "DISTINCT" does not work with blob columns (in Oracle 10g anyway) and hence the oracle error: ORA_00932.

The approach I had was to customise the offending query to simply remove "DISTINCT", especially since TOLVENUSER table already has a primary key on ID column anyway - the "DISTINCT" was hence redundant in the first place.
This was done by updating a single Java file, org.tolven.security.bean.LoginBean (under TolvenEJB module). In the findUser( String principal) method, find the following line and remove "DISTINCT":
String select = "SELECT DISTINCT u FROM TolvenUser u WHERE u.ldapUID = :principal " +

I then updated this compiled class file direclty into the tolvenEJB.jar file in JBoss's tolven ear file (at "...tolven-jboss-4.2.2.GA\server\tolven\deploy\tolven.ear/tolvenEJB.jar") and restarted Jboss.

And it was smooth running all the way after that (configPhase3 and so on). I'm accessing all Tolven web app pages perfectly now.

ORA-00932: inconsistent datatypes: expected - got BLOB

"ORA-00932: inconsistent datatypes: expected - got BLOB"
This weird single-line error in JBoss's console/log made no sense at all until I added the following snippet in the server's log4j.xml to enable Hibernate logging (thanks to Joe at the Tolven Forum):
<category name="org.hibernate.SQL">
<priority value="DEBUG"/>
</category>

(Also of course modified the server logging threshold to DEBUG)

And then came this stacktrace:

2009-07-13 18:27:47,322 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [select distinct tolvenuser0_.id as id27_, tolvenuser0_.ldapUID as ldapUID27_, tolvenuser0_.lastLogin as lastLogin27_, tolvenuser0_.creation as creation27_, tolvenuser0_.status as status27_, tolvenuser0_.sponsorship_id as sponsor19_27_, tolvenuser0_.timeZone as timeZone27_, tolvenuser0_.locale as locale27_, tolvenuser0_.emailFormat as emailFor8_27_, tolvenuser0_.demoUser as demoUser27_, tolvenuser0_.likeness_id as likeness18_27_, tolvenuser0_.pbeKeyAlgorithm as pbeKeyA10_27_, tolvenuser0_.salt as salt27_, tolvenuser0_.iterationCount as iterati12_27_, tolvenuser0_.encodedEncryptedPrivateKeyInfo as encoded13_27_, tolvenuser0_.PRIVATE_KEY_SIZE as PRIVATE14_27_, tolvenuser0_.PRIVATE_KEY_ALGORITHM as PRIVATE15_27_, tolvenuser0_.x509EncodedKeySpec as x16_27_, tolvenuser0_.PUBLIC_KEY_ALGORITHM as PUBLIC17_27_ from tolven.TolvenUser tolvenuser0_ where tolvenuser0_.ldapUID=? and (tolvenuser0_.status='ACTIVE' or tolvenuser0_.status='active' or tolvenuser0_.status='new' or tolvenuser0_.status='ACTIVATING' or tolvenuser0_.status='')]
java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got BLOB

at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
at org.tolven.security.bean.LoginBean.findUser(LoginBean.java:73)
at org.tolven.security.bean.LoginBean.createOrUpdateUser(LoginBean.java:314)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:115)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:795)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
2009-07-13 18:27:47,338 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 932, SQLState: 42000
2009-07-13 18:27:47,338 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00932: inconsistent datatypes: expected - got BLOB


Once the erring query was out in the open (in bold above), I tried executing it in an SQL window and identified that the error was being thrown on those columns of this table that were of type BLOB.
And Google quickly told me that Oracle doesn't like using "SELECT DISTINCT..." on any BLOB columns of a table. Voila!

Wednesday, June 24, 2009

VB Macro for deleting or detecting duplicate Outlook Mails

There are so many times that one cant help but wonder at how in spite of all the advances in comfort etc etc, life seems a lot harder than ever... sighhh.

For example, all the haphazard shifting around at office over the last 3 years has resulted in me accumulating a mountain of disorganised backups. Most notable are the outlook backups in PST formats (what are .pst files? They are Outlooks default backup file format extension). I was getting fed-up of helplessly grinding my teeth because of all the duplicate emails in different folders and different PSTs...
..especially when the solution was right in front of my eyes - A simple VB macro!

Finally I took time out to get it done and with a very polished form too as can be seen below screnshots.
To make it easy to carry around, I've stored it as an Excel file.

Download my file or scroll down further to see code to customize.

Excel file containing the macro.

The launched macro!

App in action!
Functionality
The Macro identifies any duplicate items in 2 outlook folders (even those in different PST files) and optionally marks those items.

It does this by simply comparing all the mails (or any Outlook item) in the 2 locations specified and marks the duplicate mails (in both the folders) with a tag of your choice on the Categories attribute of that email. So it only marks duplicate mails and does not do the actual deleting (those who want to automate this step can easily add an extra line in the code to delete instead of mark, but I found it too risky). An option is available to disable even the marking so that you only get the duplicate count in the summary.

Inputs
The actual program inputs are the names of the Outlook PST file and the mail folder of the 2 locations. Of course, if you want to compare 2 folders in the same PST, just provide the same PST name in both sets and choose the different folders.
The other input is the name of the label you want to apply against the Categories attribute for duplicate e-mails.
Finally, there is an option to enable marking of duplicate items.

Steps
Ensure Outlook is running before launching the macro or it will not be able to get the PSTs files loaded in Outlook.
1) Start the Macro.
2) The macro fetches the PST files loaded in your Outlook application and displays the form.
3) Select the PST file in set1. The set1 list gets updated with the folders in this PST file. Select the first folder you need to compare.
4) Similarly, select the PST file in set2. The set2 folder list gets updated with the selected PST file contents. Select the second folder you need to compare here.
5) Next choose whether to Mark the Duplicates or simply show a summary of duplicate sets.
6) Ok Button gets enabled when all the right options are selected.
7) Click on the OK button to start the process! This indexing step of the process may take time for large number of items... a progress bar displays the progress as well as a status bar with basic updates. When the process is done, the status shows the Completed message (and other statistics if you scroll up).
8) Manual step of actual deleting duplicate mails: After running the program, you have to open the Outlook folder that you want to clean up and sort by the Categories column to see those marked in Duplicate like below (the Categories column is hidden by default - this has to be added from the Field Chooser dialog box):
Results showing marked mails under attribute, "Categories"

You can give a quick look to make sure they are really duplicates. Then you simply shift-select those mails and delete! :)

Performance
Efficiency was increased by indexing the 2 folders before identifying duplicates- for 3000 + 1000 emails in the 2 folders, without indexing it took a few hours and still didnt finish (because there would be 3000 * 1000 reading of outlook items)! Now it runs in 5 mins.

Customisation
The current macro only compares the Subject and Creation Date of 2 emails to identify if they are the same (which is actually fairly safe). If you want, you can have more precision by editing the code to check more mail attributes.
Also as mentioned before it is simple to change the code to delete duplicate mails instead of just marking them.

I made the macro portable by embedding it in an Excel document with a launcher button (what you see in the background of the first 2 screens above). The Excel document containing all the code is available here. Of course, you can also create the macro right into your Outlook client itself (you'll have to copy the code manually from the Excel-macro code page to your Outlook-macro code page).

Below is the core code which is called from the form:


Const PST1_NAME = "NewBackup"
Const PST2_NAME = "NewBackup"
Const FOLDER1_NAME = "Inbox"
Const FOLDER2_NAME = "OldInbox"
Const CATEGORY_SEPERATOR = ","
Const FINAL_PROGRESS_ALLOCATED = 20 ' between 1 and 100

Public progressValue 'this holds the percentage completed.
Public progressStatus 'this holds the current status.

' sample with hardcoded psts & folders
Private Sub markDuplicateEmails()
markDuplicates PST1_NAME & SEPERATOR & FOLDER1_NAME, PST2_NAME & SEPERATOR & FOLDER2_NAME, DEFAULT_CATEGORY
End Sub

' actual method which takes dynamic pst\folder source and destination
Public Sub markDuplicates(source, destination, category)
Dim myOlApp, myNameSpace
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")

Dim tmpArray, pst1Name, pst2Name, folder1Name, folder2Name
tmpArray = Split(source, SEPERATOR)
pst1Name = tmpArray(0)
folder1Name = tmpArray(1)
tmpArray = Split(destination, SEPERATOR)
pst2Name = tmpArray(0)
folder2Name = tmpArray(1)

Dim folder1Size, folder2Size
folder1Size = myNameSpace.Folders(pst1Name).Folders(folder1Name).Items.Count
folder2Size = myNameSpace.Folders(pst2Name).Folders(folder2Name).Items.Count

Dim array1() As cstData, array2() As cstData
ReDim array1(folder1Size)
ReDim array2(folder2Size)

Dim outlookItem1, outlookItem2, i, j
Dim theCstmData As Module1.cstData
Dim startTime, endTime

'populate array1
i = -1
startTime = Now
progressStatus = "Indexing set1..."
For Each outlookItem1 In myNameSpace.Folders(pst1Name).Folders(folder1Name).Items
i = i + 1
Set theCstmData.item = outlookItem1
theCstmData.subject = outlookItem1.subject
theCstmData.creationTime = outlookItem1.creationTime
array1(i) = theCstmData
progressValue = 100 * (i / (folder1Size + folder2Size + (folder1Size + folder2Size) * (FINAL_PROGRESS_ALLOCATED / 100)))
DoEvents
Next outlookItem1
progressStatus = "Indexing set1 Complete."
' populate array2
i = -1
progressStatus = "Indexing set2..."
For Each outlookItem2 In myNameSpace.Folders(pst2Name).Folders(folder2Name).Items
i = i + 1
Set theCstmData.item = outlookItem2
theCstmData.subject = outlookItem2.subject
theCstmData.creationTime = outlookItem2.creationTime
array2(i) = theCstmData
progressValue = 100 * ((folder1Size + i) / (folder1Size + folder2Size + (folder1Size + folder2Size) * (FINAL_PROGRESS_ALLOCATED / 100)))
DoEvents
Next outlookItem2
progressStatus = "Indexing set2 Complete."
progressStatus = "Indexing time: " & (Now - startTime) * 60 * 60 * 24

'loop through each item in array1
progressStatus = "Applying Category labels on duplicates..."
For i = 0 To folder1Size - 1
'loop through each item in array 2 comparing each array2Item with current array1item
For j = 0 To folder2Size - 1
' if it is a match mark the item in array2 as duplicate
If array1(i).subject = array2(j).subject And _
array1(i).creationTime = array2(j).creationTime Then
If array1(i).item.Categories = "" Then
array1(i).item.Categories = category
Else
array1(i).item.Categories = array2(j).item.Categories & CATEGORY_SEPERATOR & category
End If
array1(i).item.Save

If array2(j).item.Categories = "" Then
array2(j).item.Categories = category
Else
array2(j).item.Categories = array2(j).item.Categories & CATEGORY_SEPERATOR & category
End If
array2(j).item.Categories = category
array2(j).item.Save
End If
DoEvents
Next j
progressValue = (100 - FINAL_PROGRESS_ALLOCATED) + (FINAL_PROGRESS_ALLOCATED * (i / folder1Size))
Next i
progressStatus = "Total Time: " & (Now - startTime) * 60 * 60 * 24
progressStatus = "All done."
End Sub


Update [25-Jun-09]:
New features
- Option to only count duplicates instead of Marking.
- Now displays even sub-folders recursively
- 2 new status views available to display number of items in selected folder.
- Other performance enhancements
See screenshot below:


Update [03-Jul-09]:
New features
-support for choosing same folder in set1 and set2. This will mark/count duplicate sets of mails in the same folder.

Update [15-Feb-12]:
New features
-Support for identifying Missing mails - choose source and destination folders, and all mails missing in destination will be identified.
-Support for marking labels as well as just counting Duplicates or Missing mails


Note: This was tested on Outlook 2003 but should work on any outlook...

Thursday, June 18, 2009

The Little Guide of IT Jargons and Acronyms

Here's an age-old problem perhaps much before the time Pythogaras stated to a non-mathematical audence: "The square of the hypotinuse..."

See most of us techies are really proud of the way we can rattle of so many tech terms and especially acronyms. Unfortunately, a sentence like that would just go right over a non-techie client or a new team member. What makes things worse is that requirement and document acronyms often vary from company to company.

Of course there are people who use them a lot to show off... and its the general opinion of the other crows that lots of jargon/acronyms implies you are loud-mouthed and/or not really knowledgeable. I absolutely agree when I hear Sales people at Mutual Funds talking about CAMS (of course I do catch them red handed if its a computer shop salesperson!).

Unfortunately a lot of the times, we techies are simply unaware when we're doing it! Perhaps what we could do is distribute a common acronym list before a client meeting? Something like below... of course the list would grow (or shrink?) based on client feedback after every meeting.

I would keep updating as the list would be obviously too large to put up at one go!
The Little Guide of IT Acronyms:
Tech Acronyms
BPM - Business Process Mangement
EDI - Electronic Data Interchange
ETL - Extract, Transform, Load
JSeam - JBoss Seam
RIA - Rich Internet Application
SaaS - Software as a Service
SOA - Service Oriented Archiecture
SOBA - Service Oriented Business Application
XSD - Xml Schema Definition
WSDL - Web Service Definition Language

Doc acronyms
CDS/FDS/TDS - Component/Functional/Technical Design Specification
Specs - Requirement Specifications
SSRS - Sub-System Requirements Specification
UTP - Unit Test Plan
UTR - Unit Test Results

Other
UIT/UAT - User Integration/Acceptance Testing

Saturday, May 23, 2009

Must have tools for Kubuntu

CCD2ISO
Converts most CloneCD image file (.ccd) to standard ISO image. Only iso images can be mounted in linux.

Some useful one-off commands in Kubuntu

This post will be regularly updated with commands as I come across them...

Mounting an iso image
1) First create the location where you want the mount to be made:
mkdir /MyISOMount1

2) Mount the iso:
sudo mount -t iso9660 CoolStuff.iso /MyISOMount1 -o loop
where CoolStuff.iso is the image and /MyISOMount1 is the location where the image is to be mounted.

3) When you're all done, simpy unmount:
sudo umount /MyISOMount1

Monday, May 11, 2009

Hardware Monitor for Kubuntu

One thing I missed in my "new" old linux system is a hardware monitor tool to pick up the temperature, fan speed and any other statistics available directly from my hardware... in windows, there were so many to pick from and plenty of reviews and articles. I was surprised such a tool was not bundled with the Kubuntu Installation and nor did any turn up in the Add/Remove App.

The good news is that it is available for linux but is not as simple as install and run as in most stuff in linux. In fact, the hardware monitoring is actually present in the default installation of Kubuntu 8.04 through the lm-sensors package (verify this is already installed from Adept or Synaptic manager and install this if not present).

However lm-sensors has no UI. Presenting a choice of 2 UI tools, K-Sensors and Kima, to fill in this gap.

Note: lm-sensors is not a driver package - it will simply use drivers already installed by Kububtu. This works fine for most desktops but in the case of laptops, chances are slim that kubuntu drivers will be present for hardware monitoring. So lm-sensors wont help.

But before you use these UI tools, you need to setup your system by doing the following:
1) Open a terminal (simply open Konsole in Kubuntu).

2) Next, you need to run a program from lm-sensors package to detect and list all your hardware that has sensors.
Run the following command and hit Enter (yes) to all the subsequent prompts except the last one, "Do you want to add these lines automatically?" (unless you really want to)
sudo sensors-detect

This program will show at the end a summary of all the hardware modules that needs to be added for monitoring
Something like:
#----cut here----
# Chip drivers
it87
coretemp
#----cut here----

Note: If you get a message like "no sensors detected", this most probably means none of your hardware have sensors or your kubuntu drivers are not able to detect them

3) Next you need to include the linux kernel modules detected by running the modprobe command for each of the modules between "cut here"
So for the example above, type and run each of the following (normally you need to prepend with "sudo" to run in admin mode):
sudo modprobe it87
sudo modprobe coretemp

That's it. Now you can install (do it from Adept or Synaptic of course) and run your selected UI tool.

Ksensors can be started normally from the KDE start menu. You'll need to go to it's options menu and add the neccessary sensors you want to monitor.

Kima will not be present in the start menu as it is actually a Kicker applet. To start Kima, right click your bottom panel, select add Applet to panel and select Kima from the list. Kima will run as an applet in Kicker. Again you would need to go to it's conigure menu and add the sensors you want to monitor.

Finally, verify that the values you see in the sensor are accurate as they may be garbled by a factor or 2 sometimes (actual Sensor readings are usually accessible in your system bios).

Monday, April 27, 2009

Checkstyle Bug - "Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'DUSException'".(?) and Solution

Was in the code review phase last week... time for checkstyle, findbugs n PMD to come out!

Since it was a new project, with a little tinkering of a half-working Hudson ant script someone was working on, I could generate my Review reports. My checkstyle task was like below:
<target name = "checkstyle">
<mkdir dir="${checkstyle.report}"/>
<taskdef resource="checkstyletask.properties" classpath ="${checkstyle.home}/checkstyle-all-4.4.jar;${checkstyle.home}/checkstyle-optional-4.4.jar" />
<checkstyle config="${basedir}\..\settings\CheckstyleSettings.xml" failonviolation="false">
<fileset dir="${src.java.dir}" includes="**/*.java"/>
<formatter type="xml" toFile="${checkstyle.report}\checkstyle_errors.xml"/>
</checkstyle>

<style in="${checkstyle.report}\checkstyle_errors.xml" out="${checkstyle.report}\checkstyle_report.html"
style="${basedir}\..\settings\checkstyle.xsl"/>
</target>

Unfortunately, the Checkstyle Reports kept giving a strange Error in some classes:
"Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'DUSException'." at Line 0.
Classes which had this error would have no other Errors although the Warnings were not affected.

However, in my Eclipse editor with Checksyle Plugin and the same Checkstyle settings, I would get normal Checkstyle Errors and Warnings without thie Error.

Clearly, this was some Checkstyle runtime error and not an error in my class which resulted in Checkstyle failing to process that class for Errors.

Searched the net and came up with lots of explanations / bug accusations that made a lot of sense but no easy solution... Checkstyle was somehow missing out the DUSException class when it was encountered in a throws tag of a methods Javadoc.

So i decided to manually add my source class files to the classpath... and it worked!
<checkstyle config="${basedir}\..\settings\CheckstyleSettings.xml" failonviolation="false">
<classpath>
<path location="${classes.dir}" />
<path refid="code-lib-classpath" />
</classpath>
<fileset dir="${src.java.dir}" includes="**/*.java"/>
<formatter type="xml" toFile="${checkstyle.report}\checkstyle_errors.xml"/>
</checkstyle>

Unfortunately, the Checkstyle report started showing the real CS Errors and they doubled! :) But the team could finally tackle 'em bugs before they slipped to the next phase...


Strange thing was that most of the (new) team was also getting the same Checkstyle Bug in Eclipse... which was what made me assume that it really was a CS Bug.
Until I had a look at their CS preferences and found that they were applying CS on .java files only. Once it was changed to apply to all files, the issue was resolved in their Eclipse as well

Thursday, February 26, 2009

Uploading apps onto GoogleAppEngine behind a proxy

Was stuck for a while trying to upload my google app from the latest Google App Engine 1.1.9 - what should have been an instant upload turned out to be an all-day adventure because of the complication of behind a proxy that required user/password authentication...

But finally got it to work with the following steps (from a Win XP machine using Python v2.6.1)!

1) Install the Python patch 1424152 from http://bugs.python.org/issue1424152. They only have diff files there - so for those who don't know how to apply diff patches, I have attached the 2 PATCHED files (urllib2.py & httplib.py) for Python 2.6.1. Just replace your corresponding files in your Python26\Lib folder with these (WARNING - these files were patched specifically for Python 2.6.1. For any other Python version, you have to patch your appropriate file from the patch link above).

2) Download the latest ntlmaps proxy (v0.9.9?) from http://ntlmaps.sourceforge.net/
(its only 71kb!).
Change the following attributes in server.cfg: PARENT_PROXY, NT_DOMAIN, USER, PASSWORD.
You can leave the password empty and it will prompt you when you start ntlmaps.

3) Set the following environment values:
set HTTP_PROXY=localhost:5865
set HTTPS_PROXY=localhost:5865
(5685 is the default port used by ntlsmaps which can be changed in server.cfg)

4) Start up the ntlsmaps proxy by running runserver.bat (you might have to edit the
bat file to point to your actual python executable).

5) Test whether ntlsmaps is working by changing your browser proxy to point to
localhost:5865, and try to access some sites. If this fails, your proxy is probably
not understood by ntlsmaps or vice versa - try to finetune ntlsmaps some more.

6) Finally run your upload command:
appcfg.py update xyz/
Hopefully you should get something like this:
...\appcfg.py:40: DeprecationWarning: the sha
module is deprecated; use the hashlib module instead
DIR_PATH,
Scanning files on local disk.
Initiating update.
Email: xyz@gmail.com
Password for xyz@gmail.com:
Cloning 2 static files.
Cloning 5 application files.
Deploying new version.
Checking if new version is ready to serve.
Will check again in 1 seconds.
Checking if new version is ready to serve.
Closing update: new version is ready to start serving.
Uploading index definitions.

Tuesday, February 24, 2009

Error reading from file ... .msi Verify that the file exists and that you can access it

Got a confounding error that occurred when trying to install an msi file on windows XP:

(Error reading from file ... .msi
Verify that the file exists and that you can access it.)


After quite a bit of hair-pulling, I realised this was happening because I had removed Security rights to all users except myself for this folder... including the System group!

I suppose since the System is what performs actions on msi to unpack it, etc, it needs rights here.
So all I had to do was to put the msi file in a folder that has System rights.

In this case, I simply enabled access for System group to the directory and the problem was solved.



Friday, February 20, 2009

Dynamic Label Cloud Gadget

Was looking for a label cloud widget for the blog but was surprised to see no one had come up with any dynamic cloud generator... was a matter of merging a little unused math with simple javascript and the Dynamic Cloud Generator gadget was born.

If you're happy with the gadget (or even particularly upset!), for any feedback, queries or bugs do make a post in Google's gadget directory for this gadget here.
When posting problems, provide as much information like the Gadget properties, what browser the problem is seen, etc.

Gadget Properties:
Cloud Label Max Font Size
eg: 25
Provide the font size for the biggest (most occurring) label.

Cloud Label Min Font Size
eg: 8
Provide the font size for the smallest (least occurring) label.

Cloud Background Colour
eg: red, #aabbdd
Change this from the default value of '#FFFFFF' (white) if you want another background colour.

Cloud Link Colour
This is for choosing the colour of the cloud links.

Base Url For Label link (change this)
eg: http://devsac.blogspot.com/search/label
This is the URL for creating the links that appear on each of the labels in the label cloud - the URL is simply prepended to the Label tag. If the user clicks on the tag "Cool", the URL in this case would be http://devsac.blogspot.com/search/label/Cool

Feed URL to retrieve Labels from (change this)
eg: http://devsac.blogspot.com/feeds/posts/default
You can simply give your blog's Blogger RSS Atom feed (in this case, you can skip the below Label Element and Attribute properties). If you don't have a Blogger atom feed or have a non-standard xml file containing your labels, then provide that URL.

Name of Label Element in Feed URL
eg: category
Leave this with default value as "category", if you provided a Blogger Atom RSS feed for above Feed URL property.
Otherwise, provide the name of the element that contains the labels in your xml.

Name of Label Attribute in Feed URL
eg: term
Leave this with default value as "term", if you provided a Blogger Atom feed for above Feed URL property.
Otherwise, provide the name of the attribute containing the labels in your xml.

Ignore Label Attribute in Feed URL
Leave this as default unchecked if you provided a Blogger RSS Atom feed for above Feed URL property.
Enable this if you are provided a Feed URL that stores the the Label as a value in the Label Element and not in an attribute (such as the RSS feed from Feedster).

Minimum Label Occurences
This is an optional property which will be skipped if it has default value of 0.
This can be used when only those labels that occur more than a minimum count need to be displayed in the cloud.
For e.g.:, if you want to consider only labels that have occurred more than once, then give 2 for this property.

Maximum Label Occurences
This is an optional property which will be skipped if it has default value of 0.
This can be used when only those labels that occur less than a maximum count need to be displayed in the cloud.
For e.g.:, if you want to consider only labels that have occurred less than 100 times, then give 99 for this property.


Updates:
v0.008 [25-May-09]:
Added new properties, min and max label occurrences for feature request from Randi Helene Tillung.
v0.007
Fixed bug that left out border of gadget when setting background colour, Raised by Eemil.
v0.006
Fix for bug in "Ignore Label Attribute" option.
v0.005
Added
"Ignore Label Attribute" option for those who have non-Blogger rss feeds like Feedster RSS.


Properties, etc can be viewed at this Google page.
 
Superblog Directory