rblog

Splitting text using Python

Created a script just to test how to split text using Python. First I have to split on the delimiter ‘__’, then on the ‘.’.

#!/usr/bin/python
propertyFilename="commons-ear__R01_INC_002.properties"
print propertyFilename
versionWithFileExt = propertyFilename.split('__')
print versionWithFileExt
version = versionWithFileExt[1].split('.')
print version
#And to get the final string
print version[0]

Not that hard, but what confused me when reading the Python documentation was that str.split() is deprecated. But as it turned out, that is in version 2.7, currently we are using 2.4, find out by issuing the command
ls -l /usr/bin/python*

From version 2.7 you should instead use stringObject.rpartition(sep), see more at about.com

Adding a description when installing an application using wsadmin

Using wsadmin to install an application I wanted to add a description to an application edition. Was not able to find any documentation telling me what are valid parameters to apply to the options string, so I just tried “-description”, returning the error

WASX7107E: Invalid options specified: "[description]"; valid options are:
CloneWorkClassClientTask
MapModulesToServers
BindJndiForEJBNonMessageBinding
BindJndiForEJBMessageBinding
MapEJBRefToEJB
MapWebModToVH
CtxRootForWebMod
EnsureMethodProtectionFor20EJB
MapSharedLibForMod
SharedLibRelationship
JSPCompileOptions
JSPReloadForWebMod
CustomActivationPlan
GetServerName
preCompileJSPs
nopreCompileJSPs
distributeApp
nodistributeApp
useMetaDataFromBinary
nouseMetaDataFromBinary
deployejb
nodeployejb
createMBeansForResources
nocreateMBeansForResources
reloadEnabled
noreloadEnabled
deployws
nodeployws
processEmbeddedConfig
noprocessEmbeddedConfig
allowDispatchRemoteInclude
noallowDispatchRemoteInclude
allowServiceRemoteInclude
noallowServiceRemoteInclude
useAutoLink
nouseAutoLink
usedefaultbindings
defaultbinding.force
allowPermInFilterPolicy
noallowPermInFilterPolicy
verbose
update
update.ignore.old
update.ignore.new
installed.ear.destination
appname
edition
edition.desc
reloadInterval
validateinstall
filepermission
buildVersion
blaname
asyncRequestDispatchType
deployejb.rmic
deployejb.dbtype
deployejb.dbschema
deployejb.classpath
deployejb.dbaccesstype
deployejb.sqljclasspath
deployejb.complianceLevel
deployws.classpath
deployws.jardirs
defaultbinding.datasource.jndi
defaultbinding.datasource.username
defaultbinding.datasource.password
defaultbinding.cf.jndi
defaultbinding.cf.resauth
defaultbinding.ejbjndi.prefix
defaultbinding.virtual.host
defaultbinding.strategy.file
filepermission
target
server
node
cell
cluster
contextroot
custom
installed.ear.destination

So, in order to get the information, just create an error 🙂