Shell Script Question re: Cut Training Policy
My shop uses KXEN version 5.1.3, and I've inherited an older shell script that defines the CutTrainingPolicy as "random". Here is a piece of the code:
createModel Kxen.SimpleModel newmodel
newmodel.getParameter ""
newmodel.changeParameter Parameters/CutTrainingPolicy "random"
newmodel.validateParameter
newmodel.pushTransformInProtocol Default Kxen.RobustRegression
newmodel.pushTransformInProtocol Default Kxen.ConsistentCoder
newmodel.openNewStore Kxen.FileStore c:/temp
newmodel.newDataSet Training train.txt
etc.
A user has requested that I test a custom cutting strategy without test, so I set it up in the GUI and exported the script. It now looks like:
#GENERATED_BY_KXEN
# KXEN Shell Script
# generated on 2014-08-13 17:16:07
# by KXEN version 5.1.3
default STORE_USER ""
default STORE_PWD ""
default DESC_USER ""
default DESC_PWD ""
#Declaring the 'ESTIMATION' store and space
default ESTIMATION_STORE_TYPE "Kxen.FileStore"
default ESTIMATION_STORE_NAME "D:\DATA/199710"
default ESTIMATION_STORE_USER $STORE_USER
default ESTIMATION_STORE_PWD $STORE_PWD
default ESTIMATION_STORE_ALIAS myEstimationStore
default ESTIMATION_SPACE "model219.txt"
#Declaring the 'VALIDATION' store and space
default VALIDATION_STORE_TYPE "Kxen.FileStore"
default VALIDATION_STORE_NAME "D:\DATA/199710"
default VALIDATION_STORE_USER $STORE_USER
default VALIDATION_STORE_PWD $STORE_PWD
default VALIDATION_STORE_ALIAS myValidationStore
default VALIDATION_SPACE "model219.txt"
default MODEL_SAVE_STORE_TYPE "Kxen.FileStore"
default MODEL_SAVE_STORE_NAME "."
default MODEL_SAVE_STORE_USER ""
default MODEL_SAVE_STORE_PWD ""
default MODEL_SAVE_NAME "target_model219.bigtrain"
default MODEL_SAVE_SPACE "target_model219.kxen"
default MODEL_SAVE_COMMENT "The model 'target_model219.bigtrain' has been saved"
createModel Kxen.SimpleModel m
m.getParameter ""
m.changeParameter Parameters/CutTrainingPolicy "random"
m.setName "target_model219.bigtrain"
m.validateParameter
etc
I can see that the ESTIMATION and VALIDATION data sets are now defined, but the policy still says "random". Does this matter? Should I override the value? I can't find anything in the API docs.
Thank you,
Scott
Can anyone tell me if I've posted this in the correct forum?
Thanks,
Similar Messages
-
I'm writing a shell script and I need to get $PWD. There's a cd command in my script, and my script needs to navigate back to the directory in which it was executed. Is this possible? If so, how would I go about doing it? Sorry if this is in the wrong board.
In the future, you may want to post Unix and Terminal oriented questions to the Mac OS X Technologies > Unix Forum
<http://discussions.apple.com/forum.jspa?forumID=735> -
Hi all,
I know this is a little bit off subject but i have a shell scripting problem and was wondering if any of you could help...
so:
L=`wc -l $CATALINA_HOME/webapps/EmailSignup/Data/add.txt`
stores the number of lines some file has...
eg output:0 /usr/local/tomcat4/webapps/EmailSignup/Data/add.txt
so now i want to have an if statement that will compare to see if the number of lines are equal to zero...
how can i do that... this is what i do but it never seems to go in the if...
it always goes in the else..
if [ "$L" == " 0 /usr/local/tomcat4/webapps/EmailSignup/Data/add.txt" ] ;
then
echo $L
echo No additions to the Email List
else
echo --$L
echo Adding new entries to the Email List
fi
any ideas?
thanks
udamTry using the '-eq' operator of the 'test' program. (Square [] brackets in a Bourne shell script invoke the '/bin/test' program for your convenience. See the man page for 'test' for more info.)
'-eq' compares two values NUMERICALLY, while '==' compares two values as STRINGS.
Oops, I see what the other poster said about the leading space. What you really need to do is cut the number out of the string. You don't care about the file name.
if [ `echo "$L" | cut -c 1-7` -eq 0 ] ;
then
echo $L
echo No additions to the Email List
else
echo --$L
echo Adding new entries to the Email List
fi -
Simple Shell Script Question.... [java related]
Hey guys! This is my first post, as im new here :S
I have a simple problem for a big program.
We have a .sh to install it, but when I run the .sh in terminal like i should, It says the class is not found. I believe it has to do with the syntax, as the person who made it is not a linux pro. I don't know MUCH about shell scripts, but I'm pretty sure I know where the error lies.
Our Script:
java -classpath ./:./jars/tools.jar:./jars/nexus.jar impsoft.nexus.installer.Install
chmod a+x run.sh compile.sh
The Error:
Exception in thread "main" java.lang.NoClassDefFoundError: impsoft/nexus/installer/Install
What I think the problem is:
./jars/nexus.jar impsoft.nexus.installer.Install
Thank you for ALL of your help!Hi Justin,
Have you tried running the lines from the command line?
The second thing you may want to try is changing the relative directory for the jar file from a relative one to a fixed directory. From the error, it appears that the install program is running but it is not able to locate a library mentioned in the program (which is probably the jar file listed in the classpath).
Hope that helps.
J. Haynes
Denver -
[SOLVED] Simple Shell Scripting Question - Echo and Execute?
I've got a bash script which has many different commands it executes in a row. Each time the script executes one of the commands, it outputs what it is doing to the screen:
echo "cp -r home new"
cp -r home new
echo "mv testfile new/."
mv testfile new/.
I am just wondering if there is a function to execute a command and output it at the same time. Something like...
echoandexecute("cp -r home new")
echoandexecute("mv testfile new/.")
Last edited by tony5429 (2008-08-27 19:59:04)Otherwise you can define it yourself:
echoandexecute() {
echo $1
$1
echoandexecute "cp -r home new"
Last edited by catwell (2008-08-27 20:57:16) -
I'm an IBM guy and I was assigned this MAC projet. I'm a MAC noob. I have a multi-user eMac. The user account folders are blown away when the computer shuts down leaving just the root accout and default account. I included a new javapolicy file in the default user account. A file called java.policy resides in the user home folder at log in (/users/johndoe/java.policy) for every new user that logs in. I need to create a logon shell script that finds the java.policy file in their home folder and renames it .java.policy to make it hidden. Remaming it in the default profile is not an option, and I don't know who will be using the computer at any given day. Can someone help me with the code.
#!/bin/bash/
I'm clueless, thanks for the helpThe generic bash rename syntax for your specified command is:
mv /Users/shortuser/javapolicy /Users/shortuser/.java.policy
Here's a typical script:
#!/bin/bash
mv /path/to/source/.java.policy /Users/shortuser/.java.policy
The most direct mechanism would be via a computer login preference and workgroup manager, setting up a script that executes at user login. That script is invoked at login and can copy over or create the required file. Another of the usual techniques for executing commands at login is the so-called [login hook (HT2420)|http://support.apple.com/kb/HT2420], though if you're using Open Directory (OD) or OD with Active Directory (AD), it'll probably be better to go that way than the login hook.
Other discussions [here|http://arstechnica.com/civis/viewtopic.php?f=20&t=416343] and [here|http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-appl et.html]
I'd tend to expect to see the policytool used for this file, too. Launch Terminal.app and see +man policytool+ for details on that.
I'd also tend to expect to see this sort of stuff established within the system-wide policy module from the JRE that's usually located in [the system library directory |http://stackoverflow.com/questions/4372060/java-security-file-location-on-mac- snow-leopard] (/Library/Java/Home/lib/security/java.policy) and not with a per-user setting, too, and that's a rather different approach than populating the per-user settings. (But then I'm not a Java geek.)
FWIW, it's "Mac" and not "MAC", it's Unix, and files and directories doesn't get blown away unless there's a problem somewhere, or unless this is a school or kiosk or other environment that's using specific system-reset processing. And if there's system-reset processing here, then you'll obviously need to work within that. That processing is usually associated with OD, hence the earlier pointers. (And if there's this sort of reset processing going on, there's usually a reason for it, I'd probably try to keep as much sensitive stuff out of the local directories as I could reasonably manage.) -
How to write dbms_out traces into a file (in a shell script)?
I'm afraid this is a shell scripting question:
I have the following lines in a script:
ls $salida/EXAR* | while read FILE
do
sqlplus -s user@isntance/password << EOF
set serveroutput on size 1000000
set feedback off
--set trimspool on
var p_out_result_nv number
var p_out_DescError_SV varchar2(4000)
var p_out_Traza_SV varchar2(4000)
var p_Fich_Entrada varchar2(4000)
--spool $mi_fich_log
begin
:p_Fich_Entrada := replace(('$FILE'),('$salida/'),'');
dbms_output.put_line('Tratando archivo: '||:p_Fich_Entrada);
:p_out_result_nv := 0;
SJPAMIOB.SJPRPRIN('01',:p_Fich_Entrada,:p_Fich_Entrada,'EXSJ_ENTRADA','EXSJ_SALIDA',
:p_out_result_nv,:p_out_DescError_SV,:p_out_Traza_SV);
end;
--spool off
exit :p_out_result_nv
EOF
How can I write all dbms_output.put_line in a file?
Thanks in advance.you can use the package utl_file.
for this you either
- need a directory object in the database which points to the folder where your file is located you want to write to:
CREATE DIRECTORY lutz_dir AS ´/home/oracle/UTL_FILE_DIR´;
You will need create any directory privilege for this.
or
- you must have the init.ora parameter UTL_FILE_DIR set to the location.
Regards,
Lutz -
Trying to create a shell script to cut/paste files in finder. Help needed.
I'm trying to create an automator shell script to cut/paste. It'll function exactly like copy/paste. i.e. I'll just copy file/files with command+c like always, but then I'll create an automator which uses the "mv" terminal app to move the files which works exactly like cut paste.
I need some help since I don't know the syntax for creating shell scripts.
What I did so far is to do it in automator with Apple Script which goes like the following:
on run {input, parameters}
tell application "Finder"
set theWindow to window 1
set thePath to quoted form of (POSIX path of (target of theWindow as string))
end tell
tell application "Terminal"
do script with command "mv \"" & input & "\"" & thePath in window 1
end tell
return input
end run
This gets the copied file path from clipboard before, as input, and then recognizes the active finder window as thePath so then executes the mv command for the input file to the thePath window.
It doesn't work as expected since it connects both file/window paths into a single path instead of leaving a space between them so the mv command can't recognize two separate paths.
What's the correct syntax for that line
do script with command "mv \"" & input & "\"" & thePath in window 1
to leave a space between input and thePath under the mv command?
Also this requires the terminal app to be open in the background.
After I get this to work I want to do the exact same thing using shell script within automator, so I won't need Terminal to be open all the time.
And the next step will be to cut/paste multiple files/folders but that should be easy to do once I get the hang of it.Try using:
on run {input, parameters}
tell application "Finder"
set theWindow to window 1
set thePath to quoted form of (POSIX path of (target of theWindow as string))
end tell
do shell script "mv \"" & input & "\" " & thePath
return input
end run
(45977) -
Beginner question - testing for null string from shell script command
I'm trying to test the result of a shell script command. I want to put out a message if the result is a null string. At present I get this applescript error "The command exited with a non-zero status"
I'm sure this is a simple question ... but I can't figure out how to do it. Help!You can use try clause for the problem:
set _result to ""
try
set _result to do shell script "/blah/andblah"
end -
Editing question, preferably with "do shell script"
I would like to edit an expression
from: blah blah /Paragraphs/one two three
to: blah blah /Paragraphs/one-two-three
where "/Paragraphs/" is always present
but "one" might be anything
Using sed with regexp seems like a way to go, but I don't know how to designate "one," which will vary. Viz.:
set T to "blah blah /Paragraphs/one two three"
set T1 to do shell script "echo " & quoted form of T & " | sed 's/\\/Paragraphs\\/{anything}/\\/Paragraphs\\/{anything}(change all subsequent spaces to "-")/g'"Hi,
Can't believe I did it with sed! My test.txt file looks like this:
blah blah #one here's some text
blah blah #two more text
blah blah #three and even more text
#four number begins this line
Here's the sed part:
sed 's/#/\
#/' < test.txt | sed '/#/ s/ /-/g' | sed '
N
s/\n#/#/
Here I used "#" instead of "/Paragraphs/". Now, you translate this into a do shell script. If you need help with that, then write back. I now understand the N command for working with multiple line processing. Here's the tutorial I used:
http://www.grymoire.com/Unix/Sed.html
Edited: and here's the output
blah blah #one-here's-some-text
blah blah #two-more-text
blah blah #three-and-even-more-text
#four-number-begins-this-line
gl, -
.sh shell script Xcode question
So in my application I'd like to include a shell script and have a button execute it
for the sake of keeping things simple lets say the shell script is "mkdir ~/1234"
Now I have the button on the interface and i have the shell script saved in a file named script.sh
how to I make the button execute the shell script
(also I would like to do this without using applescript)Have a go at this tutorial. There really isn't a simple way we can explain how to do what you need. It's not hard, but there are several critical things you need to learn.
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjCTutori al/01Introduction/01Introduction.html
Best of luck.
Eric -
Two questions regarding shell scripts in automator
they are both concerning this script:
I pass it an .avi file (I believe it could also take more than one), and outputs a converted file (that is playable on appletv2) that is dumped in my "Converted" folder. This all works fine and dandy.
However, I would like to have it prompt the user for a destination folder, and pass that in as well. However, I do not know how I would refer to that variable separately.
Handbrake's CLI application also produces output that shows what percentage the conversion is at, and although the script passes this output as it's own output (to the next automator action - I actually discovered this only by accidentally leaving a "Speak Text" action in), I want to be able to see this output in real time. Is there anyway to do this? Thanks for the help!To be clear, this is what you mean, correct?
for outpath; do :; done
for f in "$@"
do
if [ "$f" != "$outpath" ];
thenof="$outpath"/`basename "$if" .avi`.mp4
/Applications/HandBrakeCLI -i "$if" -o "$outpath" --preset="AppleTV 2"
fi
done
I assume that "Ask For Finder Items" also passes it's input along to the next action? Would "Get Value of Variable" do the same thing? (I also use the same workflow to convert .mkv files and copy .srt files to the same destination folder, so I need to access the source files multiple times to filter out different files each time).
I would just test it myself, but I am not at my computer right now.
And this is kind of off topic, but since automator actions can be written in shell script, could this be easily made into one? How much work would it involve? -
Shell scripting basic question
I wrote as shell script .p02ibm to set my env but its not working when i run it, wondering what i am doing wrong?
[oracle@localhost ~]$ echo $SHELL
/bin/bash
vi .p02ibm
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_SID=p02ibm
export ORACLE_SID
EDITOR=vi
export EDITORJust curious why you are creating a new file when you probably should be adding the oracle user's enviroment variables to the .bash_profile in the $HOME directory.
The shortened setting method is:
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
Normally you would add them under this section (in the .bash_profile):
# User specific environment and startup programs
Rick -
Sending an email using shell script in Oracle Applications
Hi,
I have a pl/sql package which will call a shell script program.The shell script program is written in order to send the invoice hold details of AP as a mail.The parameters to this program are passed in the pl/sql package.
The shell script program has
5 parameters namely
to - email
from - email
hold id - which is a number
hold name - varchar2( free text)
hold reason - varchar2( free text)
the shell script looks as below.
FROM_EMAIL=`echo $1|cut -f9 -d " "|sed 's/\"//g'`
echo "From email id is $FROM_EMAIL" -- From email
TO_EMAIL=`echo $1|cut -f10 -d " "|sed 's/\"//g'`
echo "To Email id is $TO_EMAIL" -- to email
PARAM0=`echo $1 | awk '{print $11}'|sed -e "s/\"//g"`
echo "Param0: $PARAM0" -- hold id
PARAM1=`echo "$1" | cut -d" " -f12-| sed -e "s/\" \"/\"^\"/g" | awk -F'^' '{print $1}'|sed -e "s/\"//g"`
echo "Param1: $PARAM1" -- hold name
PARAM2=`echo "$1" | cut -d" " -f13-| sed -e "s/\" \"/\"^\"/g" | awk -F'^' '{print $1}'|sed -e "s/\"//g"`
echo "Param2: $PARAM2" -- hold reason
the values that am passinf to this program are if suppose
from email ---- [email protected]
to email [email protected]
12345 ------ hold id
test hold name ------ hold name
test hold reason ------- hold reasonIs there a question here?
In any case you could easily have done this inside the database using UTL_SMTP. -
How do you make like a dialogue box appear when I am using sudo scripts?
It might be helpful if you could provide a bit more detail about the goal. Your original question asked about an actual password dialogue, but if there is someone there to enter an "admin" password, why can't they use the "Accounts" pref pane? For example, I could see this being the case if the current account was "managed" with access to secure pref panes restricted, but a few posts later, your example of 'sudo passwd admin' implies that it is an "admin" account's password that is to be changed. But why would an "admin" want to change their password from a "managed" account... Without knowing what exactly the goal is, it is difficult to provide meaningful suggestions.
But speaking more generally, changing 'do shell script "sudo ..."' to 'tell application "Terminal" to do script "sudo ..."' should cause a "Terminal" window to open, with a password prompt in a command line interface.
Alternatively, rather than using 'sudo' in "do shell script" statements, it is possible to use "with administrator privileges" to avoid the need for the interactive password (and don't combine 'sudo' with "with administrative privileges" because it is apparently insecure).
http://developer.apple.com/technotes/tn2002/tn2065.html
To incorporate a password dialog into a "do shell script ... with administrative privileges" statement, you could use Tiger's new "hidden answer" option in the standard "display dialog" statement. While this does obscure the password, I don't think it is particularly secure either.
Finally, 'passwd' also requires an interactive password, whereas 'dscl' doesn't with some options, (nor does 'pwpolicy' but that won't work unless password policy options are enabled), so 'dscl' might be more suitable in a script. However, options where the password is provided in the command are also less secure since theoretically the password could be viewed in plain text by someone running 'ps' at the right time...
Maybe you are looking for
-
How can I change my apple iD in my iCloud account info on my iPhone 4
How can I change my Apple ID in my iCloud account for my iPhone 4? I have updated to my new Apple ID on iCloud and iTunes, but my phone still shows my old apple id, thus it's not letting me restore previously backed up info.
-
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
Hi All Its my first time to use RMAN in our ERP EBSR12 our database version is 11g Please help how to resolv and make successfully backup RMAN> backup database; Starting backup at 24-JAN-11 using channel ORA_DISK_1 channel ORA_DISK_1: starting full d
-
Digital Oout on X-Fi Xtreme Audio doesn't w
for some reason the digital out (optical) to my receiver stopped working for some reason and I have no idea how to make it work. anybody has simmilar problem? thanks?
-
ITunes/iPod displays album tracks out of order
I have this weird problem where one of my albums has three tracks that display out of order. http://i55.tinypic.com/mtwf0x.png I can't think of anything in the tags that would cause this. They're all identical in terms of album/artist/# of tracks...
-
Is it Possible to define Levels within Levels in a Dimension
Hi is it possible to define Levels within Levels in Dimension??