Efficient command line validation.
Efficient command line validation and method invoking .
I'm mulling over an efficient way to validate command line parameters passed into a program and then call methods attributed to those parameters.
I can of course use
Many if else
A switch
But I'm wondering on the efficiently of using a lookup such as java.util.Properties to validate and then reflection the call the corresponding method. I am uncertain of the overhead involving reflection when used in this way. Or is there a way to efficiently validate many command line parameters and then call its corresponding method.
A problem with reflection is I don't want to leave the methods public.
- Ideas ?
So at this point you've already dealt with arguments like:
yourProgram -file index.txt(i.e., where the next String in argv[] is the value of the argument)
and now you're using this system to invoke functionality, generically, in your application?
So:
java laudromat -startWashwill start the washing machine going?
If that's the case, then actually a name like "process" or "execute" is fine, I think. That's the Command pattern where something like this is expected, I believe. I'd prefer "execute" over "process", myself, because "process" suggests processes running in the OS, etc., to me. "executeOption" is I think redundant.
If the application can take multiple options, then does this mean that the program will perform multiple actions simultaneously? If so, then you'd need multiple threads, and there's already the "run" method there. In which case, it's not clear whether you really even need an Option interface -- maybe Runnable will be sufficient.
I'm just brainstorming here, maybe none of this is applicable to your application.
Similar Messages
-
MS SSIS command line call "Argument for option 'set' is not valid"
Hi all,
I'm tring to execute a SSIS package from command line. Here's the code:
dtexec.exe /file "E:\TestIS\IntegrationServicesProject1\IntegrationServicesProject1\Package.dtsx" /set \Package.Variables[User::Name].Properties[Value];20150314
and it return a error saying "Argument for option 'set' is not valid". I've configure the package and generated a XML file. And do exactly as the official doc says. However, this line of code just doesn't work. If I delete the set option
and run the package alone, it can be ran. So anyone can help me out? Thank you in advance.Hi NoahdeArk,
In SQL Server Integration Services, string literals must be enclosed in quotation marks. The expression language provides a set of escape sequences for commonly escaped characters such as nonprinting characters and quotation marks. A string literal consists
of zero or more characters surrounded by quotation marks. If a string contains quotation marks, these must be escaped in order for the expression to parse. For more details, please see:
https://msdn.microsoft.com/en-us/library/ms141001.aspx
So to troubleshoot this issue, please refer to the following command:
dtexec.exe /file "E:\TestIS\IntegrationServicesProject1\IntegrationServicesProject1\Package.dtsx" /set \Package.Variables[User::Name].Properties[Value]; \"20150314\"
Or
dtexec.exe /file "E:\TestIS\IntegrationServicesProject1\IntegrationServicesProject1\Package.dtsx" /set \Package.Variables[User::Name].Properties[Value]; \""20150314"\"
The following similar threads are for your references:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/af4f62e1-b600-49d7-98c2-4a35c9fef404/escape-character-for-set-option-of-dtexec
http://stackoverflow.com/questions/9612471/dtexec-error-setting-multiple-variables
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support -
hello frends
We are currently getting this error.
Command Line argument is not valid please verify the switch.
The code used to send the mail is
mail ="mailto:?subject="+escape(subject)+"&body="+escape(email);
document.location = mail;
return ;
this is a javascript code to open outlook mail to send emails.
the main problem is,when we write
mailto:?subject=abc&body=uvwxyz......
then we should be getting abc as subj and uvwxyz as the body..,and we r getting it....
but when we include ""(double quotes ) in either the subject or the body..,it is showing the error line mentioned above.
and if em using the html tags in the body part..,it's giving everything including the tags,which z not desired.
kindly help me .....shikha6g wrote:
i've thought..,you people are brainy enough to help me out in the javascript too...!!so..,i relied on this forum and have posted my problem,coz solving this thing was really imp for me.
i din't knew,dat i'll get such circastic replys here.sorryTo me, being brainy implies that you are a smart thinker and good at problem solving. It doesn't mean that you know a language that you never learned. -
Hello,
I am running a sql job which runs SSIs pakcage imported from Integration Service Sever..
it give me this error.... the server is :10.2.8.39 and the database is process
how can I fix It?Hello Arthux ,, thx alot for your help,,, I run the job again and this time it gives me this error ??
Date,Source,Severity,Step ID,Server,Job Name,Step Name,Notifications,Message,Duration,Sql Severity,Sql Message ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted
11/28/2011 13:58:09,SSISScoreCardsSDM,Error,0,OPLINKDEVINTRA\OPLINKDEVINTRA,SSISScoreCardsSDM,(Job outcome),,The job failed. The Job was invoked by User LINKDOTNET\michael.philip. The last step to run was step 1 (SDM).,00:00:01,0,0,,,,0
11/28/2011 13:58:10,SSISScoreCardsSDM,Error,1,OPLINKDEVINTRA\OPLINKDEVINTRA,SSISScoreCardsSDM,SDM,,Executed as user: LINKDEV\OPSQLADMIN. Microsoft (R) SQL Server Execute Package Utility Version 10.50.1600.1 for 64-bit Copyright (C) Microsoft
Corporation 2010. All rights reserved. Option " /CONNECTION" is not valid. The command line parameters are invalid. The step failed.,00:00:00,0,0,,,,0 -
How to create a "Command Line"/"Text Validation"
I want to create a command line like the picture. I'm using "Input Text" method for text. Variable name is "myText", Instance Name is "line".
How can I use "if" in input text like this:
Command name is: exit, if user wrote "exit" command, exit the flash app.This is a pretty old thread (I know I came across this while searching for something similar recently), but I figured I'd throw this out there in case other people might find this useful. As I write this, JavaFX's latest version is 1.3... which may have added the needed functionality since the last post.
You can now create a multi-line text area using a TextBox and by specifying the nubmer of lines and setting the "multiline" value to true. It may not offer all of the same functionality as JTextArea, but it did the job for what I needed... newlines by pressing enter, scrollbar if text surpasses height, etc.
Here's a simple example:
Group {
content: [
TextBox {
text: "This is a multi-line textbox"
lines: 10 // <-- this may/may not be necessary depending on your situation. Default is 5.
multiline: true
}Edited by: loeschg on Jul 29, 2010 2:59 PM -
sql server:- 2008 r2 stardard edition
os:- 64
Package is password procted.
following is command line in ssis package .
/FILE "E:\PostgressToSql_IPMS\PostgressToSql_IPMS\PostgressToSql.dtsx"
/DECRYPT /CONNECTION "Server.user";"\"Data Source=server;
User ID=user;Provider=SQLOLEDB.1;Persist Security Info=True;
Application Name=SSIS-Package-{DD33AC67-4A45-40D6-AF70-4BBD421931C1}BPOSQLDB01\BPOSQLDB01.log4BPO;
Auto Translate=False;\"" /CONNECTION "server.conn 1";
"\"Data Source=server;User ID=log4BPO;Initial Catalog=edb1;
Provider=SQLOLEDB.1;Persist Security Info=True;Auto Translate=False;
Application Name=SSIS-Package-{665E3825-6AFC-4DD3-ABC8-50B5F0F18EEB}server.conn 1;
\"" /CHECKPOINTING OFF /REPORTING E
Need change something? Seperate configuaration file required ?Hi Dinesh,
Based on my research, the issue is caused by you are running a SSIS package with a connection manager that has a space-character in the connection name.
To work around this issue, please refer to the following two suggestions:
Rename the connection manager in THE package to not include certain special characters (spaces, dashes). Note that the connection manager name can be changed without having to edit any property of the connection string itself.
Escape quote the connection name, such that
/CONNECTION "server.conn 1";"..."
becomes
/CONNECTION "\"server.conn 1\"";"..."
The following similar issue is for your reference:
https://connect.microsoft.com/SQLServer/feedback/details/510869/dtexec-commandline-fails-when-connection-is-passed-to-commandline-and-connection-name-contains-a-space
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Command line transfer of TM backup to Time Capsule
I have just purchased a new 3TB Time Capsule to replace my ailing 750GB Firewire drive as my Time Machine Backup drive. However, the 750GB drive has none TM files on it, that I do not want to transfer to the new Time Capsule (see details below)
file://localhost/Volumes/LaCie%20BackUp/Backups.backupdb/
file://localhost/Volumes/LaCie%20BackUp/IBM%20DDRS-39130D%20Media/
file://localhost/Volumes/LaCie%20BackUp/Orphans%20Folder/
file://localhost/Volumes/LaCie%20BackUp/Files%20from%20Server/
The reason I am doing it this way is also because my old drive occassionaly goes into a 'pause' that requires me to disconnect it from my MacBook Pro and reconnect it to try again. Thus I need to be able to transfer my backup files in smaller chunks than a whole disk image would entail, so that if the drive stops, I can pick up from the point of failure and carry on rather than start from scratch again.
Only the Backups.backupdb needs to be transferred to the Time Capsule, so I don't want to use Disk Utility and have been trying to copy the relevant backup directories using Terminal and the 'cp' command as SuperUser. However, I am finding that even so I am getting error messages back stating 'Operation not permitted', mainly to do with cp trying to run 'lchmod'.
I have read the existing FAQ article https://discussions.apple.com/message/11422415#5 and have all the correct journaling settings, etc. and the data seems to be transferring fine. Just not sure yet if I will have fully functional backups when I have finished.
Any command line help such as using the appropriate flags, etc. would be helpful.
Thanks, RussPondini's notes are quite useful and I tried using SuperDuper and Disk Utility. I transferred my backups from my old 750GB Firewire400 backup drive to my new 3TB Time Capsule using both of them. Each time I tried, the transfer took to an inordinately long time - it failed any time up to a maximum of 18 hours from starting, the best only achieved about 90% transfer!
Also, I discovered by monitoring my MacBook's performance with Activity Monitor that both these programs are CPU intensive and indicated between 150% to 200% activity (both CPUs virtually maxed out), mostly with Finder activity. This was the limiting factor in the transfer and the process was achieving peak Disk I/O and network transfer rates of 10MB/s. The MacBook's fans were running full-blast during this time just trying to keep the thing cool!
I eventually found the most efficient method to transfer backups by reading through some of the Unix command manual pages and discovered Apple Software Restore (ASR). This command is used as the underlying tool by both SuperDuper and Disk Utility and does all the actual work. The final transfer tool less than 7 hours.
Network Transfer Rate 36MB/s (sustained)
Disk I/O Rate 52MB/s (peak), >32MB/s (sustained)
CPU activity 20% (peak), <15% (typical)
Main process is 'diskimages-helper'
The reason it works much better is that only the essential work is being done and that the command allows you to alter the buffer size to make it more efficient for the larger file transfer method. The whole transfer was therefore limited purely by the maximum transfer speed of the Firewire 400 drive itself. So here is how I did it using terminal:
$ su
Password:
[change to superuser so you don't have problems with passwords and permissions, etc.]
sh-3.2# nice -n -20 asr restore --source <source drive> --target <target drive> --erase --noprompt --allowfragmentedcatalog --buffers 8 --buffersize 64m --noverify
Validating target...done
Validating source...done
Repartitioning target device...done
Warning: You may not be able to start up a computer with the target volume.
Validating sizes...done
Restoring ....10....20....30....40....50....60....70....80....90....100
Remounting target volume...done
After mounting the resulting Time Capsule BackUp, it had the name of my old drive, which confused me somewhat, so I simply renamed it in the Finder.
Explanation:
The 'nice -n -20' command tells the OS X kernal to prioritise the commands that follow by giving them preferential access to CPU time (kind of like putting go-faster-stripes on).
The <source drive> is selected by dragging the drive icon onto the terminal window.
The <target drive> has to have been created first by running an initial Time Machine Backup on the Time Capsule, which creates the .sparsebundle directory. Once this is created, stop Time Machine, then use the finder to log onto the Time Capsule and double click the .sparsebundle file. This will mount a disk called 'Time Capsule Backup'. Drag this image onto the terminal window as the target drive.
--erase removes any other stuff on the target drive and matches the journaling to the source drive
--noprompt stops you getting "do you want to continue? messages
--allowfragmentedcatalog ensures the directory catalogue on the source drive is read as is
--buffers 8 the default is 8, but I tried it with different numbers of buffers, but it didn't affect transfer speeds much
--buffersize 64m this made the most difference as the default is 1MB. Changing the buffer size makes the biggest impact as large file transfers work better when you give them large buffers.
--noverify - I used this as the transfer itself takes so long that I wasn't really wanting to wait for it to verify as well. On the occasions that I left it to verify, that function operated at a VERY slow speed and would have taken more than 100 hours to complete. I did not have the patience to investigate as to why that was, but essentially the data transfer rate during that stage was <2MB/s. Whatever was causing it to run so slow was not limited by any resources on my MacBook Pro or the network connection, so I will let someone else work out what the issue was there. -
Command line hangs when starting OC4J with MapViewer
Hello,
I have a simple development setup with a stand-alone oc4j instance installed via the MapViewer Quick Start Kit, on an 11g database, on a Windows XP workstation.
The problem: When I start the oc4j instance everything seems to start up successfully - the AS Control, the MapViewer EAR, etc.., but the command line window hangs after the last command is executed. It does not return to the command prompt. And if I close the Command Prompt window the oc4j instance automatically shuts down. Any thoughts on why this is hanging? Or is this normal behavior? Thank you. The text of the startup is shown below.
(Oh...and if you have any idea why I am getting a string of [ConverterRule] WARNINGS, please let me know. Thanks.)
-Dan
------- Output below --------
C:\app\oracle\product\11.1.0\db_1\oc4j_mv\j2ee\home>java -jar oc4j.jar
WARNING: Code-source C:\app\oracle\product\11.1.0\db_1\oc4j_mv\j2ee\home\applica
tions\mapviewer\web\WEB-INF\lib\dms.jar (from WEB-INF/lib/ directory in C:\app\o
racle\product\11.1.0\db_1\oc4j_mv\j2ee\home\applications\mapviewer\web\WEB-INF\l
ib) has the same filename but is not identical to /C:/app/oracle/product/11.1.0/
db_1/oc4j_mv/lib/dms.jar (from <code-source> (ignore manifest Class-Path) in MET
A-INF/boot.xml in C:\app\oracle\product\11.1.0\db_1\oc4j_mv\j2ee\home\oc4j.jar).
If it contains different versions of the same classes, it will be masked as the
latter is already visible in the search path of loader mapviewer.web.web:0.0.0.
WARNING: Code-source C:\app\oracle\product\11.1.0\db_1\oc4j_mv\j2ee\home\applica
tions\mapviewer\web\WEB-INF\lib\ojdl.jar (from WEB-INF/lib/ directory in C:\app\
oracle\product\11.1.0\db_1\oc4j_mv\j2ee\home\applications\mapviewer\web\WEB-INF\
lib) has the same filename but is not identical to /C:/app/oracle/product/11.1.0
/db_1/oc4j_mv/diagnostics/lib/ojdl.jar (from <code-source> (ignore manifest Clas
s-Path) in META-INF/boot.xml in C:\app\oracle\product\11.1.0\db_1\oc4j_mv\j2ee\h
ome\oc4j.jar). If it contains different versions of the same classes, it will be
masked as the latter is already visible in the search path of loader mapviewer.
web.web:0.0.0.
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Short,null)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.lang.Short)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Byte,null)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.lang.Byte)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Integer,null)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.lang.Integer)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Long,null)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.lang.Long)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Float,null)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.lang.Float)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Double,null)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(null,java.lang.Double)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ValidatorRule end
WARNING: [ValidatorRule]{faces-config/validator} Merge(javax.faces.LongRange)
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.DateTime,null
Mar 10, 2009 10:51:19 AM com.sun.faces.config.rules.ConverterRule end
WARNING: [ConverterRule]{faces-config/converter} Merge(javax.faces.Number,null)
2009-03-10 10:51:20.500 NOTIFICATION oms root path: C:\app\oracle\product\11.1.
0\db_1\oc4j_mv\j2ee\home\applications\mapviewer\web\
09/03/10 10:51:20 mbean domain: mapviewer
2009-03-10 10:51:20.500 NOTIFICATION OMSConfig mbean regisred.
2009-03-10 10:51:20.500 NOTIFICATION MapTileServer root path: C:\app\oracle\pro
duct\11.1.0\db_1\oc4j_mv\j2ee\home\applications\mapviewer\web\
09/03/10 10:51:20 mbean domain: mapviewer
2009-03-10 10:51:20.515 NOTIFICATION MCSConfig mbean regisred.
2009-03-10 10:51:20.515 NOTIFICATION MapViewer server version: Ver1033p5_B081010
2009-03-10 10:51:20.515 NOTIFICATION using default config file: C:\app\oracle\pr
oduct\11.1.0\db_1\oc4j_mv\j2ee\home\applications\mapviewer\web\WEB-INF\conf\mapV
iewerConfig.xml
2009-03-10 10:51:20.515 WARNING dcsf:true
2009-03-10 10:51:20.531 WARNING destroying ALL mapmaker instances.
2009-03-10 10:51:20.531 WARNING dcsf:true
09/03/10 10:51:20 Oracle Containers for J2EE 10g (10.1.3.1.0) initialized
2009-03-10 10:51:20.578 NOTIFICATION Spatial Provider shapefileSDP has been regi
stered.
2009-03-10 10:51:20.578 NOTIFICATION Map Recycling thread started.
2009-03-10 10:51:20.593 NOTIFICATION *** Oracle MapViewer started. ***
2009-03-10 10:51:21.515 NOTIFICATION *** Oracle MapTileServer started. ***
2009-03-10 10:51:21.531 NOTIFICATION *** Oracle Feature of Interest (FOI) Server started ***
---> This is where it hangs up. It just sits here and never returns to the command prompt.I guess I've come to the conclusion that it's normal for the command window to remain open while mapviewer is running. I just don't recall that from my previous installations.
-- considered answered. -
Can I combine two pdf files by using command lines?
Hi
I always need to combine two pdf files into one in my regular work
Currently, I open one of them, press ctrl+shift+I,
find another file and double click it.
It works but not so efficient since I need to do
this procedure many times everyday
So I'm looking for a better solution
Something like command lines,
for example:
acrobat.exe "combine" "doc1.pdf" "doc2.pdf"
Does acrobat have these functions or not?
Thx &
Best RegardsFile > Combine
-
Error while running aiaconfig.sh - The command line argument(s) "weblogicConfig"
Hi.
We are Configuring PIP on AIA 11.1.1.7 after installing AIA PIP release. we we run ./aiaconfig.sh we are getting below error message,
$./aiaconfig.sh
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 169130 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-11-20_04-11-10AM. Please wait ...adevaia @soa-odi-dev1:/u02/app/Oracle/Middleware/AIAHOME/bin$ [WARN ][jrockit] MaxPermSize=256m ignored: Not a valid opt ion for JRockit
Log: /u01/app/oraInventory/logs/install2013-11-20_04-11-10AM.log
The command line argument(s) "weblogicConfig" or the install mode specified is not valid.
Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
Usage:
config.sh [-mode] [-options] [(<CommandLineVariable=Value>)*]
Where mode include:
[Mode is a mandatory parameter. Only one mode can be specified.]
-silent For silent mode operations, the inputs can be a response file or a list of
command line variable value pairs.
Where options include:
-help, --help, --usage
Displays above usage.
-invPtrLoc <inventory pointer file>
Launches the installer with a custom inventory location. The invPtrLoc
should point to a file which contains the following information.
inventory_loc=<inventory_location>
inst_group=<group_name>
-response, -responseFile <response file>
Specifies the response file and path to use.
-jreLoc <location>
Path where Java Runtime Environment is installed. OUI cannot be run without
it.
-logLevel <level>
To filter log messages that have a lesser priority level than <level>.
Valid options are: severe, warning, info, config, fine, finer, finest,
basic, general, detailed, trace. The use of basic, general, detailed, trace
is deprecated.
-debug For getting the debug information from OUI.
-force Allowing silent mode installation into a non-empty directory.
-printdiskusage
Log debug information for disk usage.
-printmemory
Path where Java Runtime Environment is installed. OUI cannot be run without
it.
-printtime
Log debug information for time usage.
-waitforcompletion
For windows. setup.exe will wait for completion instead of spawning the
java engine and exiting.
-noconsole
For suppressing display of messages to console. Console is not allocated.
-ignoreSysPrereqs
For ignoring the results of the system pre-requisite checks.
-executeSysPrereqs
Execute system pre-requisite checks and exit.
-paramFile <location of file>
Specify location of oraparam.ini file to be used by OUI.
-novalidation
Disables the validations, can be invoked along with GUI or silent mode.
-nodefaultinput
Disables the default computation of values (pre-populating of values when
screen is loaded) in GUI install.
-nocheckForUpdates
To disable all updates checking
-updatesDir
To specify the directory where latest updates are downloaded. This could be
used in disconnected mode.
Command Line Variables Usage:
Command line variables are specified using <name=value>; for example:
[ session: | session:compName: | session:compName:version: ]variableName=" valueOfVariable"]
Installer variables are specified using:
varName=value
Ex: ORACLE_HOME=<value>
OUI Session variables are specified using:
session:varName=value
Ex: session:VARIABLE_NAME=<value>
OUI Component variables are specified using:
session:compInternalName:[Version:]varName
Ex 1: session:oracle.comp1:1.0.1:varName=<value>
Ex 2: session:oracle.comp1:varName=<value>
The lookup order is compInternalName:Version:varName, then compInternalName:varName
do anyone had any idea on this.
Thanks a lot,
RR.try checking relevant environment variables like the CLASSPATH.... a major source of failures in Windows is when in the classpath there is a path containing SPACES.... also enabling some "debug" or "verbose" flag (not sure how to do it) would provide more insight...
-
ISM-SRE-300 seems to be a loop at boot with Verifying ... Invalid signature in command line file
Any ideas?
Log
Install of ftp://*****:*****@10.100.64.21/cue-vm-k9.SPA.sme.8.6.7.pkg in progress
Install status : Waiting for RBIP registration
No localstore
2911#
[Resuming connection 1 to 10.102.66.254 ... ]
Initializing memory. Please wait...
Memory initialization OK. Continue...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
SRE step 2 - SM requests key file info...
SRE step 3 - SM stores registration info...
SRE configuration keeps the same. No flash update needed!
SRE step 4 - SM downloads key-file...
Writing keyfile to flash Size 891
writing complete.
Updating flash with bootloader configuration.
Please wait .................. done.
SRE step 5 - SM requests installer info...
SRE step 6 - SM stores installer info...
Updating flash with bootloader configuration.
Please wait .................. done.
SRE step 7 - SM now downloads installer
done.
SRE step 8 - SM requests tcl header file info...
SRE step 9 - SM now downloads the tcl header file
TCL header file downloaded completely size: 691
SRE step 10 - SM requests tcl file info...
SRE step 11 - SM now downloads the tcl file
TCL file downloaded completely size: 38933
SRE step 12 - SM now boots Installer
Verifying ... done.
Starting Kernel.
Platform: ism
INIT: version 2.86 booting
mounting proc fs ...
mounting sys fs ...
mounting /dev/shm tmpfs ...
kernel.sem = 1900 4000 32 100
vm.overcommit_memory = 1
vm.min_free_kbytes = 8192
Welcome to Cisco Service Engine
Setting the system time from hardware clock
********** rc.aesop ****************
Populating resource values from /etc/ism_rsrc_file
Populating resource values from /etc/default_rsrc_file
Populating resource values from /etc/products/cue/default_rsrc_file
Populating resource values from /etc/products/cue/ism_rsrc_file
==> Management interface is eth0
==> Management interface is eth0
IOS IP Address Registration complete.
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.102.66.0 * 255.255.255.0 U 0 0 0 eth0
default 142.102.66.254 0.0.0.0 UG 0 0 0 eth0
Size of buff is: 65536
65536 bytes written
Valid License file not found: Using default values
INIT: Entering runlevel: 2
********** rc.post_install ****************
Changing owners and file permissions.
INIT: Switching to runlevel: 4
INIT: Sending processes the TERM signal
STARTED: dwnldr_startup.sh
sre_type= 1
Welcome to Cisco Systems Service Engine Helper Software
Downloading ftp cue-vm-k9.SPA.sme.8.6.7.pkg
Bytes downloaded : 727736
Validating package signature ... done
- Parsing package manifest files... complete.
No installed manifests found.
- Checking Package dependencies... complete.
Downloading ftp cue-vm-langpack.sme.8.6.7.pkg
Error: Download error
Can not download cue-vm-langpack.sme.8.6.7.pkg
error code 550 : error type 'Can not ▒
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...ISM-SRE-300 seems to be a loop at boot with Verifying ... Invalid signature in command line file
Any ideas?
Log
Install of ftp://*****:*****@10.100.64.21/cue-vm-k9.SPA.sme.8.6.7.pkg in progress
Install status : Waiting for RBIP registration
No localstore
2911#
[Resuming connection 1 to 10.102.66.254 ... ]
Initializing memory. Please wait...
Memory initialization OK. Continue...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
SRE step 2 - SM requests key file info...
SRE step 3 - SM stores registration info...
SRE configuration keeps the same. No flash update needed!
SRE step 4 - SM downloads key-file...
Writing keyfile to flash Size 891
writing complete.
Updating flash with bootloader configuration.
Please wait .................. done.
SRE step 5 - SM requests installer info...
SRE step 6 - SM stores installer info...
Updating flash with bootloader configuration.
Please wait .................. done.
SRE step 7 - SM now downloads installer
done.
SRE step 8 - SM requests tcl header file info...
SRE step 9 - SM now downloads the tcl header file
TCL header file downloaded completely size: 691
SRE step 10 - SM requests tcl file info...
SRE step 11 - SM now downloads the tcl file
TCL file downloaded completely size: 38933
SRE step 12 - SM now boots Installer
Verifying ... done.
Starting Kernel.
Platform: ism
INIT: version 2.86 booting
mounting proc fs ...
mounting sys fs ...
mounting /dev/shm tmpfs ...
kernel.sem = 1900 4000 32 100
vm.overcommit_memory = 1
vm.min_free_kbytes = 8192
Welcome to Cisco Service Engine
Setting the system time from hardware clock
********** rc.aesop ****************
Populating resource values from /etc/ism_rsrc_file
Populating resource values from /etc/default_rsrc_file
Populating resource values from /etc/products/cue/default_rsrc_file
Populating resource values from /etc/products/cue/ism_rsrc_file
==> Management interface is eth0
==> Management interface is eth0
IOS IP Address Registration complete.
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.102.66.0 * 255.255.255.0 U 0 0 0 eth0
default 142.102.66.254 0.0.0.0 UG 0 0 0 eth0
Size of buff is: 65536
65536 bytes written
Valid License file not found: Using default values
INIT: Entering runlevel: 2
********** rc.post_install ****************
Changing owners and file permissions.
INIT: Switching to runlevel: 4
INIT: Sending processes the TERM signal
STARTED: dwnldr_startup.sh
sre_type= 1
Welcome to Cisco Systems Service Engine Helper Software
Downloading ftp cue-vm-k9.SPA.sme.8.6.7.pkg
Bytes downloaded : 727736
Validating package signature ... done
- Parsing package manifest files... complete.
No installed manifests found.
- Checking Package dependencies... complete.
Downloading ftp cue-vm-langpack.sme.8.6.7.pkg
Error: Download error
Can not download cue-vm-langpack.sme.8.6.7.pkg
error code 550 : error type 'Can not ▒
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting...
Authenticating boot loader....
Secondary Boot Loader authenticated - booting....
Please enter '***' to change boot configuration:
Detect and Initialze network device
Backup current platform configurations....
SRE step 1 - SM registration...
Response - no installation needed (len: 422)
SRE Installation Not Needed
Restoring orignial configuration...
Updating flash with bootloader configuration.
Please wait .................. done.
Loading disk:/bzImage ... Loading disk:/cmdlineextra ... done.
Verifying ... Invalid signature in command line file !!
Corrupted command line detected
done.
Starting Kernel.
Initializing memory. Please wait...
Memory initialization OK. Continue...
DDR Memory 0512 MB detected
Genuine Intel(R) processor 1.06GHz
BIOS ISM 2.6, BIOS Build date: 10/16/2009
System now booting... -
Parsing in Weblogic/jsp doesn't work; application-mode (command-line) works
Hello-
Parsing my XML file in Weblogic/jsp doesn't work, whereas it works
in application-mode... (albeit on two different machines)
Here are the parameters:
server1:
weblogic 6.0
win2k server
jre1.3
my personal machine:
***no weblogic***
win2k server
jre1.3
When I run my code as an application (command-line style) on my machine,
parsing in my xml file works fine, and I can do a root.toString() and it
dumps out the entire xml file, as desired.
However, running my code inside weblogic (on server1) in JSP, parsing in
my file and doing a root.toString() results in the following: [dmui: null]
(where dmui is my root)
(even though i'm running it on two different machines, i'm positive its the
same code (the servers share a mapped drive)...
So, I think its probably because I'm using a different parser, as
specified by weblogic? There are no exceptions being thrown. Here's my
(abbreviated) code, which is called either command line style or in a JSP:
// Imports
import org.w3c.dom.*;
import org.w3c.dom.Document;
import javax.xml.parsers.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
DocumentBuilderFactory docBuilderFactory =
DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
mDocument = docBuilder.parse (inFile);
myRoot.toString()
-END
Doing a System.getProperty("javax.xml.parsers.DocumentBuilderFactory")
results in:
server1 (weblogic/jsp):
"weblogic.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
my machine (application-mode):
null
Does anyone have any ideas about how to get this work? Do I try to set it
up so that they both use the same parser? Do I change the Weblogic parser?
If so, to what? And how?
Am I even close?
Any help would be appreciated..
Thanks, Clint
"[email protected]" <[email protected]> wrote in message
news:[email protected]...
No problem, glad you got it worked out :)
~Ryan U.
Jennifer wrote in message <[email protected]>...
I completely missed setting the property(:-o), foolish mistake. That wasit. Thanks.
"j.upton" <[email protected]> wrote:
Jennifer,
Personally I would get rid of import com.sun.xml.parser.* and use xerces
which comes with WLS 6.0 now, unless like I said earlier you have a need
to
use the sun parser :) Try something like this with your code --I've put
things to watch for as comments in the code.
import javax.xml.parsers.*;
import org.xml.sax.SAXException;
import org.w3c.dom.*;
import java.io.FileInputStream;
public class BasicDOM {
public BasicDOM (String xmlFile) {
try{
FileInputStream inStream;
Document document;
/*You must specify a parser for jaxp. You can in a simple view
think
of this as being analogous to a driver used by JDBC or JNDI. If you are
using this in the context of a servlet or JSP and have set an XML
registry
with the console this happens automatically. You can also invoke it in
the
context of an application on the command line using the -D switch. */
System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
>>>
"weblogic.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
// create a document factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// specify validating or non-validating parser
dbf.setValidating(true);
// obtain a factory
DocumentBuilder db = dbf.newDocumentBuilder();
// create a document from the factory
inStream = new FileInputStream(xmlFile);
document = db.parse(inStream);
}//try
catch (Exception e)
System.out.println("Unexpected exception reading document!"
+e);
System.exit (0);
}//catch
}//BasicDom
// Main Method
public static void main (String[] args) {
if (args.length < 1)
System.exit(1); file://or you can be more verbose
new BasicDOM(args[0]);
}//class
=============================================
That will give you a basic DOM you can manipulate and parse it fromthere.
BTW this code
compiled and ran on WLS 6.0 under Windows 2000.
Let me know if this helped or you still are having trouble.
~Ryan U.
"Jennifer" <[email protected]> wrote in message
news:[email protected]...
Actually I included com.sun.xml.parser.* as one last febble attempt toget
it working.
And as for source code, I included the code. If I just put that oneline
of code
in, including the imports, it fails giving me an error listed above inthe
subject
line. Here is the code again:
package examples.xml.http;
import javax.xml.parsers.*;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.w3c.dom.*;
import java.util.*;
import java.net.*;
import org.xml.sax.*;
import java.io.*;
public class BasicDOM {
static Document document;
public BasicDOM (String xmlFile) {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
} catch (FactoryConfigurationError e){
System.err.println(e.getException());
e.printStackTrace();
// Main Method
public static void main (String[] args) {
BasicDOM basicDOM = new BasicDOM (args[0]);Hi, Rob
Does it work in WL9.2?
It seems I do it exactly as the explained at http://edocs.bea.com/wls/docs81/programming/classloading.html - and it fails :o(.
I try to run my app.ear with WL9.2 There are 2 components in it: webapp and mdb. The webapp/WEB-INF contains weblogic.xml:
<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
Mdb is expected to run in the same mode, i.e. to prefer the webapp/WEB-INF/*.jar over the parent Weblogic classloader. To do so I add the weblogic-application.xml to the app.ear!/META-INF:
<weblogic-application>
<classloader-structure>
<module-ref>
<!-- reminder: this webapp contains
prefer-web-inf-classes -->
<module-uri>webapp</module-uri>
</module-ref>
<classloader-structure>
<module-ref>
<module-uri>mdb.jar</module-uri>
</module-ref>
</classloader-structure>
</classloader-structure>
</weblogic-application>
Now, when classloader-structure specified, both webabb and mdb prefer the weblogic root loader as if prefer-web-inf-classes not defined at all. -
How to set SAXParser at command-line interface to create a large XML file
Hi,
I am trying to create a large XML file (more than 50 MB) by selecting from Oracle database but failed because of "out of memory" error. According to "Oracle XML Developer Guide", we should use SAXParser to parsing a large XML file. But there is no example to show how to set SAXParser at command-line
Following is what I use to get xml files. It works only when the file is small.
java OracleXML getXML -DateFormat -withDTD -rowsetTag PO_HDR -conn
"jdbc:oracle:oci8:@server_name" -user "ID/password" "select * from table_name"
When I set SAXParser at the way below,
java oracle.xml.parser.v2.SAXParser OracleXML getXML -DateFormat -withDTD -rowsetTag PO_HDR -conn
"jdbc:oracle:oci8:@server_name" -user "ID/password" "select * from table_name"
it failed with the error message: "In class oracle.xml.parser.v2.SAXParser: void main(String argv[]) is not defined"
Does anyone know how to solve the problem? I'll be appreciated very much for your help.
Yihere are my ideas.
register the xml schema.
using xmldom, generate the desired xml output and return as xmltype.
then you can use something like this to check.
declare
xmldoc xmltype ;
begin
-- populate xmldoc from you xmldom function
-- validate against XML schema
xmldoc.isSchemaValid(schema_url, root_element);
if xmldoc.isSchemaValid = 1 then
--valid schema
else
--invalid
end if;
end -
Problem with tokenized input from command line
I am trying to take an input from the command line, parse it to tokens and perform whatever operation is needed depending on the name of the token, on a binary tree of stacks for example, if i type 1 2 1 3 printLevelOrder, then the root of the tree should have 3, 2,1 in the stack, the left child should have 1 and the right child should be empty. and then a level order print of the tree should be performed.
however what is happening when i run this code is the numbers are being put into the right stacks of the tree, but any commands such as printLevelOrder or PrintPopRoot are entering the code that is for placing numbers onto the stack instead of executing that command and skipping past this piece of code.
so my question is, why is the if statement if (word =="printLevelOrder") not being executed when thats whats in the word ?
example input and output shown below code fragment.
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
while (line != "***") {
System.out.print("> prompt ");
line = in.readLine();
StringTokenizer tokenizer = new StringTokenizer(line," ");
String word = new String();
while (tokenizer.hasMoreTokens()) {
word = tokenizer.nextToken();
boolean notCommand = true;
if (word =="printLevelOrder") {
theTree.printLevelOrder();
System.out.println("(word ==printLevelOrder)");
notCommand=false;
if (word == "printPopLevelOrder") {
theTree.printPopLevelOrder();
notCommand=false;
if (word == "printPopInorder") {
theTree.printPopInorder();
notCommand=false;
if (word == "printPopPreorder") {
theTree.printPopPreorder();
notCommand=false;
if (word == "printPopRoot") {
theTree.printPopRoot();
notCommand=false;
if (word == "***") {
notCommand=false;
if (notCommand == true) {
System.out.println("(notCommand == true)");
boolean notPlaced = true;
int v = 1;
while ((notPlaced==true) && (v < theTree.size())) {
if (theTree.element(v).isEmpty()) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("Inserting"+word);
System.out.println("in empty stack at location: "+v);
notPlaced=false;
if (notPlaced==true) {
if ( Integer.valueOf(word) >= Integer.valueOf( theTree.element(v).top().toString() ) ) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("Inserting"+word);
System.out.println("in stack at location: "+v);
notPlaced=false;
v++;
}valid inputs: int value, printLevelOrder, printPopLevelOrder, printPopInorder, p
rintPopPreorder, printPopRoot, *** to quit
prompt 1 3 2 4 2 printLevelOrder(notCommand == true)
Inserting1
in empty stack at location: 1
(notCommand == true)
Inserting3
in stack at location: 1
(notCommand == true)
Inserting2
in empty stack at location: 2
(notCommand == true)
Inserting4
in stack at location: 1
(notCommand == true)
Inserting2
in stack at location: 2
(notCommand == true)
Exception in thread "main" java.lang.NumberFormatException: For input string: "printLevelOrder"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.valueOf(Integer.java:553)
at TreeStack.main(TreeStack.java:73)
Press any key to continue . . .lol aww, shame that you forgot to do that. i had 10 / 10 for mine, and seing as the deadline is now well and trully over,
here is the entire source for anybody who was following the discussion or whatever and wanted to experiment.
additional files needed >
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/Stack.java
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/ArrayStack.java
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/StackEmptyException.java
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/StackFullException.java
/*TreeStack.java - reads command line input of values and assigns them to stacks in a binary tree and performs
operations on the ADT. valid inputs: <int>, printLevelOrder, printPopLevelOrder,
printPopInorder, printPopPreOrder, printPopRoot. Terminates on invalid input.
Written by George St. Clair.
S/N:0208456 22/11/2005
import java.util.Vector;
import java.io.*;
import java.util.StringTokenizer;
public class TreeStack {
private final int TREE_CAPACITY = 7 + 1;
private final int STACK_CAPACITY = 10;
Vector tree = new Vector(TREE_CAPACITY) ;
//collect input from command line, add values to stacks at nodes of the teee
//and perform required operations on the treestack
public static void main (String [] args) {
//create a tree of stacks
TreeStack theTree = new TreeStack ();
try {
//collect standard input
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
while (line != null) {
System.out.print("");
line = in.readLine();
//tokenise input
StringTokenizer tokenizer = new StringTokenizer(line," ");
String word = new String();
while (tokenizer.hasMoreTokens()) {
//assign word to the token
word = tokenizer.nextToken();
boolean notCommand = true;
//perform operation on treestack depending on what word is
if (word.equals("printLevelOrder")) {
System.out.println("printLevelOrder");
theTree.printLevelOrder();
notCommand=false;
if (word.equals("printPopLevelOrder")) {
System.out.println("printPopLevelOrder");
theTree.printPopLevelOrder();
notCommand=false;
if (word.equals("printPopInorder")) {
System.out.println("printPopInorder");
theTree.printPopInorder();
notCommand=false;
if (word.equals("printPopPreorder")) {
System.out.println("printPopPreorder");
theTree.printPopPreorder();
notCommand=false;
if (word.equals("printPopRoot")) {
System.out.println("printPopRoot");
theTree.printPopRoot();
notCommand=false;
//if word was not a command it must be a number
if (notCommand == true) {
boolean notPlaced = true;
int v = 1;
//starting at the root, find suitable place for number
while ((notPlaced==true) && (v < theTree.size())) {
//if the stack at v is empty, number goes here
if (theTree.element(v).isEmpty()) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("inserting: "+word);
System.out.println("in empty stack at location: "+(v-1));
notPlaced=false;
//if the stack is not empty
if (notPlaced==true) {
//if the value on the top of the stack is smaller than number, number goes onto the stack
if ( Integer.valueOf(word) > Integer.valueOf( theTree.element(v).top().toString() ) ) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("inserting: "+word);
System.out.println("in stack at location: "+(v-1));
notPlaced=false;
//if that node was no good, check the next one for suitability
v++;
catch (Exception e) {
//occurs when user inputs something that is neither a command, or a number, or upon EOF, or stack is full
public TreeStack () {
//create the TreeStack ADT by adding stacks in the vector, note vector 0 is instantiated but not used.
for (int i = 1;i<=TREE_CAPACITY;i++)
tree.add(new ArrayStack(STACK_CAPACITY));
public int size() {
//return the size of the tree +1 (as 0 is not used)
return tree.size();
public ArrayStack element (int v) {
//return the ArrayStack at v
return (ArrayStack)tree.get(v);
public int leftChild (int v ) {
//return left child of v
return v*2;
public int rightChild (int v ) {
//return the right child of v
return v*2+1;
public boolean children (int v ) {
//search for children of v and return true if one exists
for (int i =v;i<size();i++) {
if (i/2==v ) {
//left child found at i
return true;
if ((i-1)/2==v ) {
//right child found at i
return true;
//no children found
return false;
public boolean isInternal (int v ) {
//test whether node v is internal (has children)
if (children (v)== true) {
//has children
return true;
return false;
//print the top value in each stack encountered on a level-order traversal of tree
public void printLevelOrder() {
//for every node of tree v
for (int v = 1;v<size();v++) {
if (!element(v).isEmpty() ) {
//print the top value in stack v
System.out.println(" "+element(v).top());
else {
//stack at v is empty
System.out.println(" -");
//pop off and print the top value in each stack encountered on a level-order traversal of tree
public void printPopLevelOrder () {
//pop off and print the top value in stack v
for (int v = 1;v<size();v++) {
//for each node of tree v
if (!element(v).isEmpty() ) {
//if v isnt empty print the top value in stack v
System.out.println(" "+element(v).top());
//pop the top value in the stack at v
element(v).pop();
else {
//stack at v is empty
System.out.println(" -");
//pop off and print the top value in each stack encountered on an in-order traversal of tree
public void printPopInorder () {
printPopInorder (1);
public void printPopInorder (int v) {
boolean isInternal = false;
if (isInternal (v)) {
//use a boolean for isInternal to save on running the method twice
isInternal = true;
//recursively search left subtree
printPopInorder (leftChild(v));
//pop off and print the top value at v
if (element(v).isEmpty() ) {
//stack at v is empty
System.out.println(" -");
else {
//if v isnt empty print the top value in stack v then pop
System.out.println(" "+element(v).top());
element(v).pop();
if (isInternal ) {
//recursively search right subtree
printPopInorder (rightChild(v));
//pop off and print the top value in each stack encountered on an pre-order traversal of tree
public void printPopPreorder() {
printPopPreorder(1);
public void printPopPreorder(int v) {
//pop off and print the top value at v
if (!element(v).isEmpty() ) {
//if v isnt empty print the top value in stack v then pop
System.out.println(" "+element(v).top());
element(v).pop();
else {
//stack at v is empty
System.out.println(" -");
if (isInternal (v)) {
//recursively search left and right subtrees
printPopPreorder (leftChild(v));
printPopPreorder (rightChild(v));
//pop off and print all values from the stack at the root
public void printPopRoot (){
//while the root stack has values left
while (!element(1).isEmpty()) {
//print, then pop
System.out.println(" "+element(1).top());
element(1).pop();
} -
Why does this code fail in command line?
I am using the "ListDemo" from the java swing tutorial. If I compile it on the command line
javac ListDemo.java
It compiles fine. Then when I run it, it says:
C:\Development\Java\Projects\Projects>java ListDemo
Exception occurred during event dispatching:
java.lang.NoSuchMethodError
at ListDemo.createAndShowGUI(ListDemo.java:196)
at ListDemo.access$400(ListDemo.java:7)
at ListDemo$1.run(ListDemo.java:217)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Yet when I load up the same file into Netbeans, it compiles and runs fine! Here is the file:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
/* ListDemo.java is a 1.4 application that requires no other files. */
public class ListDemo extends JPanel
implements ListSelectionListener {
private JList list;
private DefaultListModel listModel;
private static final String hireString = "Hire";
private static final String fireString = "Fire";
private JButton fireButton;
private JTextField employeeName;
public ListDemo() {
super(new BorderLayout());
listModel = new DefaultListModel();
listModel.addElement("Alan Sommerer");
listModel.addElement("Alison Huml");
listModel.addElement("Kathy Walrath");
listModel.addElement("Lisa Friendly");
listModel.addElement("Mary Campione");
listModel.addElement("Sharon Zakhour");
//Create the list and put it in a scroll pane.
list = new JList(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSelectedIndex(0);
list.addListSelectionListener(this);
list.setVisibleRowCount(5);
JScrollPane listScrollPane = new JScrollPane(list);
JButton hireButton = new JButton(hireString);
HireListener hireListener = new HireListener(hireButton);
hireButton.setActionCommand(hireString);
hireButton.addActionListener(hireListener);
hireButton.setEnabled(false);
fireButton = new JButton(fireString);
fireButton.setActionCommand(fireString);
fireButton.addActionListener(new FireListener());
employeeName = new JTextField(10);
employeeName.addActionListener(hireListener);
employeeName.getDocument().addDocumentListener(hireListener);
String name = listModel.getElementAt(
list.getSelectedIndex()).toString();
//Create a panel that uses BoxLayout.
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane,
BoxLayout.LINE_AXIS));
buttonPane.add(fireButton);
buttonPane.add(Box.createHorizontalStrut(5));
buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
buttonPane.add(Box.createHorizontalStrut(5));
buttonPane.add(employeeName);
buttonPane.add(hireButton);
buttonPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
add(listScrollPane, BorderLayout.CENTER);
add(buttonPane, BorderLayout.PAGE_END);
class FireListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
//This method can be called only if
//there's a valid selection
//so go ahead and remove whatever's selected.
int index = list.getSelectedIndex();
listModel.remove(index);
int size = listModel.getSize();
if (size == 0) { //Nobody's left, disable firing.
fireButton.setEnabled(false);
} else { //Select an index.
if (index == listModel.getSize()) {
//removed item in last position
index--;
list.setSelectedIndex(index);
list.ensureIndexIsVisible(index);
//This listener is shared by the text field and the hire button.
class HireListener implements ActionListener, DocumentListener {
private boolean alreadyEnabled = false;
private JButton button;
public HireListener(JButton button) {
this.button = button;
//Required by ActionListener.
public void actionPerformed(ActionEvent e) {
String name = employeeName.getText();
//User didn't type in a unique name...
if (name.equals("") || alreadyInList(name)) {
Toolkit.getDefaultToolkit().beep();
employeeName.requestFocusInWindow();
employeeName.selectAll();
return;
int index = list.getSelectedIndex(); //get selected index
if (index == -1) { //no selection, so insert at beginning
index = 0;
} else { //add after the selected item
index++;
listModel.insertElementAt(employeeName.getText(), index);
//If we just wanted to add to the end, we'd do this:
//listModel.addElement(employeeName.getText());
//Reset the text field.
employeeName.requestFocusInWindow();
employeeName.setText("");
//Select the new item and make it visible.
list.setSelectedIndex(index);
list.ensureIndexIsVisible(index);
//This method tests for string equality. You could certainly
//get more sophisticated about the algorithm. For example,
//you might want to ignore white space and capitalization.
protected boolean alreadyInList(String name) {
return listModel.contains(name);
//Required by DocumentListener.
public void insertUpdate(DocumentEvent e) {
enableButton();
//Required by DocumentListener.
public void removeUpdate(DocumentEvent e) {
handleEmptyTextField(e);
//Required by DocumentListener.
public void changedUpdate(DocumentEvent e) {
if (!handleEmptyTextField(e)) {
enableButton();
private void enableButton() {
if (!alreadyEnabled) {
button.setEnabled(true);
private boolean handleEmptyTextField(DocumentEvent e) {
if (e.getDocument().getLength() <= 0) {
button.setEnabled(false);
alreadyEnabled = false;
return true;
return false;
//This method is required by ListSelectionListener.
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting() == false) {
if (list.getSelectedIndex() == -1) {
//No selection, disable fire button.
fireButton.setEnabled(false);
} else {
//Selection, enable the fire button.
fireButton.setEnabled(true);
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
JFrame frame = new JFrame("ListDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent newContentPane = new ListDemo();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();You are not running this code under JDK 1.4
The setDefaultLookAndFeelDecorated method requires JDK 1.4 version.
Maybe you are looking for
-
Can't send or receive mail from certain e-mail address...
Has anyone ever run into an instance where you couldn't send or receive mail to a 1 specific e-mail address? Even after adding the address to your contact list? Here's my situation. There is one person that is trying to e-mail me, but no matter what
-
My apple tv is not listed on my devices anymore, how do I get it back?
my apple tv is not listed on my devices anymore, how do I get it back?
-
Exception handling in synchronous client proxy
Hi, I have a synchronous outbound proxy-web service scenario. If our Post request (unknown data in the receiver) fails, the receiver system returns a 404 error that results in application error in PI. Now, I want know how to handle CX_AI_APPLICATION_
-
Query as a Web Service can't see .unx universes to use as data source?
Hi, I created a Universe using Information Designer. The Universe is published on the server as *.unx. With Query as a Web Service Designer, I connect to the server to create a query. However, in "Choose a universe as a data source for the query", I
-
HT3275 Can somebody help with this error message? Thanks.
The backup disk image "/Volumes/Patrick Shattenkirk's Time /Macintosh.sparsebundle" is already in use.