Help with FDM / vb script
Hi,
We are using Hyperion 11.1.1.3 suite. We want to load data to data warehouse from FDM (using pull adapter). We wrote trial vb script for SQL server as below and its working :
/* need help in converting the below script for Oracle server from SQL server */
'Create query string
strSQL = "bulk INSERT tdestino "
strSQL = strSQL & " FROM 'D:\FDQM.csv' "
strSQL = strSQL & "WITH(FIELDTERMINATOR = ',',ROWTERMINATOR = '\n') "
strSQL2 = strSQL2 & "select Amount, account,system, Source, Comment1,substring(Comment2,1,75) as comments "
'strSQL2 = strSQL2 & "substring(Comment2,21,40) as commentss1 "
strSQL2 = strSQL2 & "from tdestino "\
Can anyone please advice how to convert it for oracle server ?
Any suggestions/help will be appreciated.
Thanks and regards,
Nishit Shah
Hi user1180842 ,
Thanks a lot for your help. Appreciate it. I saw the .dat file is generated now we will write a script to load the data to warehouse.
Thanks
Nishit Shah
Similar Messages
-
[solved]Need help with a bash script for MOC conky artwork.
I need some help with a bash script for displaying artwork from MOC.
Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
mocp -Q %file
gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last '/'?)
A point in the right direction would be appreciated.
thanks, d
Last edited by dgz (2013-08-29 21:24:28)Xyne wrote:
You should also quote the variables and output in double quotes to make the code robust, e.g.
filename="$(mocp -Q %file)"
dirname="${filename%/*}"
cp "$dirname"/front.jpg ~/backup/art.jpg
Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
thanks for the tip.
here it is, anyhow:
#!/bin/bash
filename=$(mocp -Q %file)
dirname=${filename%/*}
cp ${dirname}/front.jpg ~/backup/art.jpg
then in conky:
$alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
thanks for the help.
Last edited by dgz (2013-08-29 21:26:32) -
Help with Custom calculation script in Acrobat 8
Hi all, I am using acrobat 8 on OS 10.5
I am trying to add certain fields (numbers) and then subtract another field value to give an end result.
I don't know anything about Javascript, would anyone be able to help with any info on how I achieve this result? I can only see Add, x and average etc... nothing there for subtraction
Thanks for any help in advance
SwenThis should get you started:
>if (event) {
// get values from two text fields
var a = Number(this.getField('Text1').value);
var b = Number(this.getField('Text2').value);
// subtract the values and show it
this.event.target.value = a - b;
Place this in a 3d text field, as a Custom Calculation Script. -
Help with first Adobe Script for AE?
Hey,
I'm trying to create a script that will allow me to set a certain number of layer markers at an even interval to mark out a song. Could someone help me troubleshoot this script? I've been working on it for ages now, and I'm about to snap. I've basically gone from HTML and CSS, to javascript and Adobe scripting in the past few hours, and I cannot figure this out for the life of me.
I want to create a dialog with two fields, the number of markers to place, and the tempo of the song. Tempo is pretty simple, its just the number of beats per minute. The script is meant to start at a marker that I have already placed, and set a new marker at incrementing times. Its mainly to help me see what I'm trying to animate too, even if the beat is a little hard to pick up every once in a while.
Also, is there a better way to do this? This script will help me in the long run because I will need to do this pretty often, but I'm wondering if there was something that I could not find online that would have saved me these hours of brain-jumbling?
Thank you very much for any help you can offer.
// Neo_Add_MultiMarkers.jsx
//jasondrey13
//2009-10-26
//Adds multiple markers to the selected layer.
// This script prompts for a certain number of layer markers to add to the selected audio layer,
//and an optional "frames between" to set the number of frames that should be skipped before placing the next marker
// It presents a UI with two text entry areas: a Markers box for the
// number of markers to add and a Frames Between box for the number of frames to space between added markers.
// When the user clicks the Add Markers button,
// A button labeled "?" provides a brief explanation.
function Neo_Add_MultiMarkers(thisObj)
// set vars
var scriptName = "Neoarx: Add Multiple Markers";
var numberOfMarkers = "0";
var tempo = "0";
// This function is called when the Find All button is clicked.
// It changes which layers are selected by deselecting layers that are not text layers
// or do not contain the Find Text string. Only text layers containing the Find Text string
// will remain selected.
function onAddMarkers()
// Start an undo group. By using this with an endUndoGroup(), you
// allow users to undo the whole script with one undo operation.
app.beginUndoGroup("Add Multiple Markers");
// Get the active composition.
var activeItem = app.project.activeItem;
if (activeItem != null && (activeItem instanceof CompItem)){
// Check each selected layer in the active composition.
var activeComp = activeItem;
var layers = activeComp.selectedLayers;
var markers = layers.property("marker");
//parse ints
numberOfMarkers = parseInt (numberOfMarkers);
tempo = parseInt (tempo);
// Show a message and return if there is no value specified in the Markers box.
if (numberOfMarkers < 1 || tempo < 1) {
alert("Each box can take only positive values over 1. The selection was not changed.", scriptName);
return;
if (markers.numKeys < 1)
alert('Please set a marker where you would like me to begin.');
return;
var beginTime = markers.keyTime( 1 );
var count = 1;
var currentTime = beginTime;
var addPer = tempo/60;
while(numberOfMarkers < count)
markers.setValueAtTime(currentTime, MarkerValue(count));
currentTime = currentTime + addPer;
if (count==numberOfMarkers) {
alert('finished!');
return;
else{
count++;
app.endUndoGroup();
// Called when the Markers Text string is edited
function onMarkersStringChanged()
numberOfMarkers = this.text;
// Called when the Frames Text string is edited
function onFramesStringChanged()
tempo = this.text;
// Called when the "?" button is clicked
function onShowHelp()
alert(scriptName + ":\n" +
"This script displays a palette with controls for adding a given number of markers starting at a pre-placed marker, each separated by an amount of time determined from the inputted Beats Per Minute (Tempo).\n" +
"It is designed to mark out the even beat of a song for easier editing.\n" +
"\n" +
"Type the number of Markers you would like to add to the currently selected layer. Type the tempo of your song (beats per minute).\n" +
"\n" +
"Note: This version of the script requires After Effects CS3 or later. It can be used as a dockable panel by placing the script in a ScriptUI Panels subfolder of the Scripts folder, and then choosing this script from the Window menu.\n", scriptName);
// main:
if (parseFloat(app.version) < 8)
alert("This script requires After Effects CS3 or later.", scriptName);
return;
else
// Create and show a floating palette
var my_palette = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName, undefined, {resizeable:true});
if (my_palette != null)
var res =
"group { \
orientation:'column', alignment:['fill','fill'], alignChildren:['left','top'], spacing:5, margins:[0,0,0,0], \
markersRow: Group { \
alignment:['fill','top'], \
markersStr: StaticText { text:'Markers:', alignment:['left','center'] }, \
markersEditText: EditText { text:'0', characters:10, alignment:['fill','center'] }, \
FramesRow: Group { \
alignment:['fill','top'], \
FramesStr: StaticText { text:'Tempo:', alignment:['left','center'] }, \
FramesEditText: EditText { text:'140', characters:10, alignment:['fill','center'] }, \
cmds: Group { \
alignment:['fill','top'], \
addMarkersButton: Button { text:'Add Markers', alignment:['fill','center'] }, \
helpButton: Button { text:'?', alignment:['right','center'], preferredSize:[25,20] }, \
my_palette.margins = [10,10,10,10];
my_palette.grp = my_palette.add(res);
// Workaround to ensure the editext text color is black, even at darker UI brightness levels
var winGfx = my_palette.graphics;
var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);
my_palette.grp.markersRow.markersEditText.graphics.foregroundColor = darkColorBrush;
my_palette.grp.FramesRow.FramesEditText.graphics.foregroundColor = darkColorBrush;
my_palette.grp.markersRow.markersStr.preferredSize.width = my_palette.grp.FramesRow.FramesStr.preferredSize.width;
my_palette.grp.markersRow.markersEditText.onChange = my_palette.grp.markersRow.markersEditText.onChanging = onMarkersStringChanged;
my_palette.grp.FramesRow.FramesEditText.onChange = my_palette.grp.FramesRow.FramesEditText.onChanging = onFramesStringChanged;
my_palette.grp.cmds.addMarkersButton.onClick = onAddMarkers;
my_palette.grp.cmds.helpButton.onClick = onShowHelp;
my_palette.layout.layout(true);
my_palette.layout.resize();
my_palette.onResizing = my_palette.onResize = function () {this.layout.resize();}
if (my_palette instanceof Window) {
my_palette.center();
my_palette.show();
} else {
my_palette.layout.layout(true);
else {
alert("Could not open the user interface.", scriptName);
Neo_Add_MultiMarkers(this);You should ask such questions over at AEnhancers. I had a quick look at your code but could not find anything obvious, so it may relate to where and when you execute certain functions and how they are nested, I just don't have the time to do a deeper study.
Mylenium -
Help with web form script. PHP, CGI, Perl???
anyone willing to help with a web form script? I have a form built, but cant seem to figure out the scripting! Should I be using Perl, CGI, PHP... What do I need to enable? I am a complete novice when it comes to scripts. Looking for a little friendly help.
Here is a simple bit of PHP to stick in the page your form posts to. You would need to edit the first three variables to your liking, and add the html you want to serve afterwards:
<pre>
<?php
$emailFrom = '[email protected]';
$emailTo = '[email protected]';
$emailSubject = 'Subject';
$date = date('l, \t\h\e dS \o\f F, Y \a\t g:i A');
$browser = $HTTPSERVER_VARS['HTTP_USERAGENT'];
$hostname = $HTTPSERVER_VARS['REMOTEADDR'];
$message = "$date\n\nAddress: $hostname\nBrowser: $browser\n\n";
foreach ($_POST as $key => $value) {
$message .= $key . ": " . $value . "\n";
$mailResult = mail($emailTo,$emailSubject,$message,"From: $emailFrom");
?>
</pre>
This script will grab the server's date and the submitter's address and browser type. It will then list the name and value of each form field you have put on your form.
Also, this script expects your form method="post".
Lastly, you can offer alternate text later on in your html page based on the success of the above script with a snippet like this:
<pre><?php
if ($mailResult) {
echo "Your comments have been received thank you.";
} else {
echo "There was an error. Please try again or contact us using an alternate method.";
?></pre> -
Help with a startup script for monitorix
How can I deal with a perl script that doesn't acknowledge a query for pidof?
$ ps aux | grep monitorix
root 1089 0.0 1.2 16280 6556 ? Ss 09:54 0:00 /usr/bin/monitorix -c /etc/monitorix.conf
So it's running... but I can't find it with pidof:
$ pidof /usr/bin/monitorix
Here is the /etc/rc.d/monitorix I've been using but that doesn't stop the program (since it has no PID).
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
PID=`pidof -o %PPID /usr/bin/monitorix`
MARGS="-c /etc/monitorix.conf"
case "$1" in
start)
stat_busy "Starting Monitorix"
if [ -z "$PID" ]; then
/usr/bin/monitorix $MARGS
fi
if [ ! -z "$PID" -o $? -gt 0 ]; then
stat_fail
else
PID=`pidof -o %PPID /usr/bin/monitorix`
echo $PID > /var/run/monitorix.pid
add_daemon monitorix
stat_done
fi
stop)
stat_busy "Stopping Monitorix"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon monitorix
else
rm_daemon monitorix
stat_done
fi
restart)
$0 stop
sleep 1
$0 start
echo "usage: $0 {start|stop|restart}"
esacAccording to the man page, the -p flag will let you generate a PID file.
You have a few logical errors in your rc.d script and a syntax error (double else in stop). I've been using a template similar to the below in cleaning up a few of the packages I maintain...
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
pidfile=/run/monitorix.pid
if [[ -r $pidfile ]]; then
read -r PID < "$pidfile"
if [[ ! -d /proc/$PID ]]; then
# stale pidfile
unset PID
rm -f "$pidfile"
fi
fi
args=(-c /etc/monitorix.conf -p "$pidfile")
case "$1" in
start)
stat_busy "Starting Monitorix"
if [[ -z $PID ]] && /usr/bin/monitorix "${args[@]}"; then
add_daemon monitorix
stat_done
else
stat_fail
exit 1
fi
stop)
stat_busy "Stopping Monitorix"
if [[ $PID ]] && kill $PID &> /dev/null; then
rm_daemon monitorix
stat_done
else
stat_fail
exit 1
fi
restart)
$0 stop
sleep 1
$0 start
echo "usage: $0 {start|stop|restart}"
esac
please also fix the PKGBUILD:
install=('readme.install')
This is not valid, and pacman 4 will not let you declare install as an array.
Last edited by falconindy (2011-09-25 15:05:02) -
Urgeant help with a java script
I really nead some help with an essay that i have for tommorow. Ok it goes like this: I have to build in java and with help of the awt library a proper interface that whill allow people to make reservation for tickets in a cinema. With the proper graphics the interface must allow the users to chose time , movie , date , and a spot in the cinema! the spot should be selected from a "picture" (like a diagramm or something) of the cinema which will be displayed on the screen...
thanx in advance!!!What do you need "help" with? No one is going to do your homework for you here. If you have a specific question or problem, feel free to ask. You have to get started yourself though.. Thought college was going to be easy?
-
Need help with PHP mail script [was: Can someone please help me?]
I'm trying to collect data from a form and email it. I'm using form2mail.php and the problem is that the email is not collecting the form info and it has the same email address in the From: and To: lines. I'm really stuck and would appreciate any help.
Here is the HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Us</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {
font-size: 14px;
color: #000000;
body {
background-color: #FFFFFF;
body,td,th {
color: #CC3300;
.style3 {font-size: 14px; font-weight: bold; }
.style6 {font-size: 18px}
.style7 {font-size: 16px}
.style8 {font-size: 16px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style9 {font-size: 16px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style10 {color: #000000}
-->
</style>
</head>
<body>
<div align="center"><img src="nav2.jpg" alt="nav bar" width="698" height="91" border="0" usemap="#Map2" />
<map name="Map2" id="Map2">
<area shape="rect" coords="560,9,684,38" href="accessories.html" />
<area shape="rect" coords="456,8,548,38" href="contact.html" />
<area shape="rect" coords="305,8,435,40" href="photog.html" />
<area shape="rect" coords="187,9,283,39" href="services.html" />
<area shape="rect" coords="81,10,167,39" href="aboutus.html" />
<area shape="rect" coords="5,10,68,39" href="index.html" />
</map>
<map name="Map" id="Map">
<area shape="rect" coords="9,9,69,39" href="index.html" />
<area shape="rect" coords="83,11,165,39" href="aboutus.html" />
<area shape="rect" coords="182,9,285,38" href="services.html" />
<area shape="rect" coords="436,14,560,37" href="contact.html" />
<area shape="rect" coords="563,14,682,38" href="accessories.html" />
</map>
</div>
<p> </p>
<form id="TheForm" name="TheForm" action="form2mail.php" method="post">
<p align="center" class="style2">P<span class="style1">lease fill out form below for a "free no obligation quote" then click submit.</span></p>
<p align="center" class="style3">(*Required Information)</p>
<div align="center">
<pre><strong><span class="style8">*Contact Name</span> </strong><input name="name" type="text" id="name" />
<span class="style8"><strong>
Business Name </strong></span><input name="bn" type="text" id="bn" />
<span class="style8"><strong>*Phone Number <input type="text" name="first" size="3" onFocus="this.value='';"
onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.second);" maxlength="3" value="###" /> - <input type="text" name="second" size="3" onFocus="this.value='';" onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.third);" maxlength="3" value="###" /> - <input type="text" name="third" size="4" onFocus="this.value='';" onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.fourth);" maxlength="4" value="####"/> </strong></span>
<strong><span class="style1">*</span><span class="style8">Email Address</span> <input name="email" type="text" id="email" /> </strong> </pre>
<label><span class="style9">*Re-enter to confirm</span>
<input name="emx" type="text" id="emx" /></label><br /><br /><span class="style9">
<label></label>
</span>
<p><span class="style9">*Best time to call </span>
<select name="name1[]" multiple size="1" >
<option>8am-9am</option>
<option>9am-10am</option>
<option>10am-11am</option>
<option>11am-12pm</option>
<option>12pm-1pm</option>
<option>1pm-2pm</option>
<option>2pm-3pm</option>
<option>3pm-4pm</option>
<option>4pm-5pm</option>
<option>5pm-6pm</option>
<option>6pm-7pm</option>
<option>7pm-8pm</option>
</select>
<br />
<br />
<span class="style9">Type of Location</span>
<select name="name2[]" multiple size="1" >
<option>Residential</option>
<option>Commercial</option>
</select>
<br />
<br />
<span class="style1"><br />
<strong><br />
<span class="style6">*Type of Services Requested:</span></strong><br />
</span><strong><span class="style10">(check all that apply)</span><br />
</strong><br />
<span class="style7"><span class="style1"><strong>Janitorial cleaning</strong></span>
<input type="checkbox" name="checkbox[]" value="checkbox" multiple/>
<br />
</span><strong><br />
<span class="style8">Mobile Auto Detailing</span>
<input type="checkbox" name="checkbox2[]" value="checkbox" multiple/>
<br />
<br />
</strong><span class="style9">Moving/Hauling</span>
<input type="checkbox" name="checkbox3[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Pressure washing</span>
<input type="checkbox" name="checkbox4[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Window washing</span>
<input type="checkbox" name="checkbox5[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Window Tinting</span>
<input type="checkbox" name="checkbox6[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Boat cleaning</span>
<input type="checkbox" name="checkbox7[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">RV cleaning</span>
<input type="checkbox" name="checkbox8[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Motorcycle cleaning</span>
<input type="checkbox" name="checkbox9[]" value="checkbox" multiple/>
<br />
<br />
<br />
<br />
<input name="SB" type="button" class="style9" value="Submit" onClick="sendOff();">
</p>
</div></label>
<script language="JavaScript1.2">
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header
var good;
function checkEmailAddress(field) {
// Note: The next expression must be all on one line...
// allow no spaces, linefeeds, or carriage returns!
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org) |(\..{2,2}))$)\b/gi);
if (goodEmail){
good = true
} else {
alert('Please enter a valid e-mail address.')
field.focus()
field.select()
good = false
function autoTab(startPoint,endPoint){
if (startPoint.getAttribute&&startPoint.value.length==startPoint.getAttribute("max length"))
endPoint.focus();
function checkNumber(phoneNumber){
var x=phoneNumber;
var phoneNumber=/(^\d+$)|(^\d+\.\d+$)/
if (phoneNumber.test(x))
testResult=true
else{
alert("Please enter a valid number.")
phoneNumber.focus();
phoneNumber.value="";
testResult=false
return (testResult)
function sendOff(){
namecheck = document.TheForm.name.value
if (namecheck.length <1) {
alert('Please enter your name.')
return
good = false
checkEmailAddress(document.TheForm.email)
if ((document.TheForm.email.value ==
document.TheForm.emx.value)&&(good)){
// This is where you put your action
// if name and email addresses are good.
// We show an alert box, here; but you can
// use a window.location= 'http://address'
// to call a subsequent html page,
// or a Perl script, etc.
window.location= 'form2mail.php';
if ((document.TheForm.email.value !=
document.TheForm.emx.value)&&(good)){
alert('Both e-mail address entries must match.')
</script>
</form>
<p> </p>
</body>
</html>
and here is the form2mail.php:
<?php
# You can use this script to submit your forms or to receive orders by email.
$MailToAddress = "[email protected]"; // your email address
$redirectURL = "http://www.chucksmobile.com/thankyou.html"; // the URL of the thank you page.
$MailSubject = "[Customer Contact Info]"; // the subject of the email
$sendHTML = FALSE; //set to "false" to receive Plain TEXT e-mail
$serverCheck = FALSE; // if, for some reason you can't send e-mails, set this to "false"
# copyright 2006 Web4Future.com =================== READ THIS ===================================================
# If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".
# If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.
# To block an IP, simply add it to the blockip.txt text file.
# CHMOD 777 the blockip.txt file (run "CHMOD 777 blockip.txt", without the double quotes)
# This is needed because the script tries to block the IP that tried to hack it
# If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name"
# you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple>
# you have to do the same with checkboxes
Web4Future Easiest Form2Mail (GPL).
Copyright (C) 1998-2006 Web4Future.com All Rights Reserved.
http://www.Web4Future.com/
This script was written by George L. & Calin S. from Web4Future.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
# DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ===================================================
$w4fver = "2.2";
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] == "" ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR']);
//function blockIP
function blockip($ip) {
$handle = @fopen("blockip.txt", 'a');
@fwrite($handle, $ip."\n");
@fclose($handle);
$w4fx = stristr(file_get_contents('blockip.txt'),getenv('REMOTE_ADDR'));
if ($serverCheck) {
if (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])) { $w4fy = TRUE; } else { $w4fy = FALSE; }
} else { $w4fy = TRUE; }
if (($w4fy === TRUE) && ($w4fx === FALSE)) {
$w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html>\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body><font face=3Dverdana size=3D2>";
if (count($_GET) >0) {
reset($_GET);
while(list($key, $val) = each($_GET)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$vala = htmlspecialchars($vala);
if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
$w4fMessage .= "$vala, ";
$w4fMessage .= "<br>\n";
else {
$val = stripslashes($val);
if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }
else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }
} // end while
}//end if
else {
reset($_POST);
while(list($key, $val) = each($_POST)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$vala = htmlspecialchars($vala);
if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
$w4fMessage .= "$vala, ";
$w4fMessage .= "<br>\n";
else {
$val = stripslashes($val);
if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }
else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }
} // end while
}//end else
$w4fMessage .= "<font size=3D1><br><br>\n Sender IP: ".$ip."</font></font></body></html>";
$w4f_what = array("/To:/i", "/Cc:/i", "/Bcc:/i","/Content-Type:/i","/\n/");
$name = preg_replace($w4f_what, "", $name);
$email = preg_replace($w4f_what, "", $email);
if (!$email) {$email = $MailToAddress;}
$mailHeader = "From: $name <$email>\r\n";
$mailHeader .= "Reply-To: $name <$email>\r\n";
$mailHeader .= "Message-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\n";
$mailHeader .= "MIME-Version: 1.0\r\n";
if ($sendHTML) {
$mailHeader .= "Content-Type: multipart/alternative;";
$mailHeader .= " boundary=\"----=_NextPart_000_000E_01C5256B.0AEFE730\"\r\n";
$mailHeader .= "X-Priority: 3\r\n";
$mailHeader .= "X-Mailer: PHP/" . phpversion()."\r\n";
$mailHeader .= "X-MimeOLE: Produced By Web4Future Easiest Form2Mail $w4fver\r\n";
if ($sendHTML) {
$mailMessage = "This is a multi-part message in MIME format.\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";
$mailMessage .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";
$mailMessage .= "Content-Type: text/html; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= "$w4fMessage\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730--\r\n";
if ($sendHTML === FALSE) {
$mailHeader .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";
if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader)) { echo "Error sending e-mail!";}
else { header("Location: ".$redirectURL); }
} else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";}
?>
Thanks in advance,
Glenn
[Subject line edited by moderator to indicate nature of request]Using PHP to process an online form and send the input by email is very simple. The mail() function takes a minimum of three arguments, namely: the address the mail is being sent to, the subject line, and the body of the email as a single string. The reason some people use scripts like form2mail.php is because they don't have the knowledge or patience to validate the user input to make sure it's safe to send.
Rather than attempt to trawl through your complex form looking for the problems, I would suggest starting with a couple of simple tests.
First of all, create a PHP page called mailtest.php containing the following script:
<?php
$to = '[email protected]'; // use your own email address
$subject = 'PHP mail test';
$message = 'This is a test of the mail() function.';
$sent = mail($to, $subject, $message);
if ($sent) {
echo 'Mail was sent';
} else {
echo 'Problem sending mail';
?>
Save the script, upload it to your server, and load it into a browser. If you see "Mail is sent", you're in business. If not, it probably means that the hosting company insists on the fifth argument being supplied to mail(). This is your email address preceded by -f. Change the line of code that sends the mail to this:
$sent = mail($to, $subject, $message, null, '[email protected]');
Obviously, replace "[email protected]" with your own email address.
If this results in the mail being sent successfully, you will need to adapt the code in form2mail.php to accept the fifth parameter. You need to change the following line, which is a few lines from the end of the script:
if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader))
Change it to this:
if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader, '[email protected]'))
Again, use your own email address instead of "[email protected]".
Once you have determined whether you need the fifth argument, test form2mail.php with a very simple form like this:
<form id="form1" name="form1" method="post" action="form2mail.php">
<p>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</p>
<p>
<label for="email">Email:</label>
<input type="text" name="email" id="email" />
</p>
<p>
<label>
<input type="checkbox" name="options[]" value="boat cleaning" id="options_0" />
Boat cleaning</label>
<br />
<label>
<input type="checkbox" name="options[]" value="RV cleaning" id="options_1" />
RV cleaning</label>
<br />
<label>
<input type="checkbox" name="options[]" value="motorcycle cleaning" id="options_2" />
Motorcycle cleaning</label>
</p>
<p>
<input type="submit" name="send" id="send" value="Submit" />
</p>
</form>
If that works, you can start to make the form more complex and add back your JavaScript validation. -
Need help with a basic script to resize image then resize the canvas
I am new to photoshop scripting, and have come across a need to force an image to be 8"x10" at 300dpi (whether it is vertical or horizontal)
I need to maintain the correct orientation in the file, so an Action will not work, I believe I have to implement a script to accomplish this.
I have the below script so far, but I am not certain of how to input the variables / paramters
doc = app.activeDocument;
if (doc.height > doc.width) doc.resizeImage("2400 pixels","3600 pixels", "300", "BICUBIC");
if (doc.height > doc.width) doc.resizeCanvas("2400 pixels","3000 pixels", "MIDDLECENTER");
if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
if (doc.height < doc.width) doc.resizeCanvas(3000,2400,"MIDDLECENTER");
When I run this script, I get the following error:
Error 1245: Illegal argument - argument 4
- Enumerated value expected
Line: 5
if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
The fact that its failing on lien 5 lets nme know that I have the "If" portions of my script correct, I just dont know how to accomplish the functions correctly.
Any help would be appreciated!
Thanks,
BrianI know I'm late here but it seems to me your trying to automate a 8"x10 or 10"x8 300DPI print.
To do that you must first crop your image to a 4:5 aspect ratio to prevent distortion unless your shooting with a 4" by 5" camera. I wrote a Plugin script a couple years ago that could help you do a centered crop. You could do the whole process by recording a simple Photoshop action that uses two Plugin Scripts only four steps would be needed.
Step 1 Menu File>Automate>AspectRatioSelection (My script based of Adobe Fit Image Plugin script) Set 4:5 Aspect ratio, center, Rectangle, Replace, no feather. Llike Fit Image this script woks on both Landscape and Portrait images. The Selection will be correct for the images orientation.
Step 2 Menu Image>Crop
Step 3 Menu File>Automate>Fit Image set 3000 PX height and 3000 PX width the Image will be Resample so its longest side will be 3000 pixels. Adobe Fit Image Plugin Script always uses BICUBIC resampling. I have a modified version of Fit Image that uses Bicubic Sharper whebndownsizing and BicubicSmoother when up sizing.
Step 4 Menu Image>Size un check resample set resolution to 300 DPI.
When you play the actions the Script Dialogs will not be displayed and the setting use when you recorded the action will ne used.
The Plugin Script are included in my crafting actions package:
http://www.mouseprints.net/old/dpr/JJMacksCraftingActions.zip
Contains:
Action Actions Palette Tips.txt
Action Creation Guidelines.txt
Action Dealing with Image Size.txt
Action Enhanced via Scripted Photoshop Functions.txt
CraftedActions.atn Sample Action set includes an example Watermarking action
Sample Actions.txt Photoshop CraftedActions set saved as a text file. This file has some additional comments I inserted describing how the actions work.
12 Scripts for actions
My other free Photoshop downloads cam be found here: http://www.mouseprints.net/Photoshop.html -
Please help with an ICM script editor syntax question.
I need to modify a set variable node. What I have now is Call.PeripheralVariable8+".wav" and this works. What I need it to say is Call.PeripheralVariable8+anything+".wav" but when I insert an * for the anything it's seen as a multiplier. What's the syntax to do this? The anything I need to add is _9xxx where xxx are other numbers, but the _9 will be in all, if that helps any. Thanks in advance !!
You can use the concatenate() function to build up your string, as you no doubt know.
As far as the wildcard goes ... your intention must be to try to SET the call variable and later on test the call variable with an IF node. Is that right?
You would be able to test parts of the string using the substr() function - which is based on character position. If that is a fixed value that you know, it's easy. If it's not, you can first use the find() function to locate something (like the "_9"), returning the position, and then use the substr() function to pull it off.
Can you write some pseudo-code here to define exactly your intention? You can set up a dummy script and send a dummy call through using Call Tracer and watch the output to see how your code is working.
Regards,
Geoff -
[SOLVED] Help with a simple script
Hi guys! A problem is connected with switching cpu governors. Usually I set it by commands and made alias in .bashrc:
sudo cpufreq-set -c 0 -g performance && sudo cpufreq-set -c 1 -g performance
sudo cpufreq-set -c 0 -g ondemand && sudo cpufreq-set -c 1 -g ondemand
sudo cpufreq-set -c 0 -g powersave && sudo cpufreq-set -c 1 -g powersave
Could you help me with script which can read system information about current cpu governor and switches the next governor
Last edited by noMaster (2012-01-27 06:36:55)noMaster wrote:
JuseBox wrote:Can you please be more specific with what you are trying to accomplish?
I need that script for set it on hotkey and change cpu states. Unfortunately I havent scripting experience
I make one thing but it doesnt work for me
### Toggle Super Hybrid Engine ##################################
she_names=("performance" "ondemand" "powersave")
she_value_performance=( "0" "performance")
she_value_ondemand=( "1" "ondemand")
she_value_powersave=( "2" "powersave")
# Find current
she_current=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
if [[ "${she_current}" == "${she_value_performance[0]}" ]]; then
she_next=${she_value_ondemand[0]}
elif [[ "${she_current}" == "${she_value_ondeman[1]}" ]]; then
she_next=${she_value_powersave[0]}
elif [[ "${she_current}" == "${she_value_powersave[1]}" ]]; then
she_next=${she_value_performance[0]}
fi
function she_toggle() {
if [[ "${she_names[${she_current}]}" != "${she_names[${she_next}]}" ]]; then
cmd="/usr/bin/notify-send -t 5000 SHE changed"
echo ${she_next} > ${she_current}
else
cmd="/usr/bin/notify-send -t 5000 SHE original"
fi
case $1 in
# "debug")
# print_debug
"powersave")
she_next=2
she_toggle
"normal")
she_next=1
she_toggle
"performance")
she_next=0
she_toggle
she_toggle
esac
### End of file #################################################
I am looking over the script. Without it, do you think you could explain what your trying to accomplish? What states and when should they toggle? Something rough to get an idea? I think if I am thinking correctly this could be easier then it seems. I will help ya. -
Hello,
Awhile back someone wrote the following script for me. The
idea was to make a comman that would allow me to reduce an image
down to 400 pixel width without loss of scale. I want to have a
similiar command that will reduce a large image down to 400 pilel
height without loss of scale. I fiddled with the command for width
but can't get it to work for height. Can I get some help rewriting
the following command to work for 400 pixel height? Thanks.
// User Variables
var width = 400;
// Command
var dom = fw.getDocumentDOM();
var scale = width/dom.width;
var height = dom.height * scale;
dom.setDocumentImageSize({left:dom.left, top:dom.top,
right:dom.left+width, bottom:dom.top+height},
{pixelsPerUnit:dom.resolution, units:dom.resolutionUnits});Tom Hersh wrote:
> I did try it that way. But I could not get it to work.
The word "scale" is critical, but I switching did not help.
Just switch the variables word for word. Height for width and
width for
height.
// User Variables
var width = 400;
// Command
var dom = fw.getDocumentDOM();
var scale = width/dom.width;
var height = dom.height * scale;
dom.setDocumentImageSize({left:dom.left, top:dom.top,
right:dom.left+width,
bottom:dom.top+height}, {pixelsPerUnit:dom.resolution,
units:dom.resolutionUnits});
// User Variables
var height = 400;
// Command
var dom = fw.getDocumentDOM();
var scale = height/dom.height;
var width = dom.width * scale;
dom.setDocumentImageSize({left:dom.left, top:dom.top,
right:dom.left+width,
bottom:dom.top+height}, {pixelsPerUnit:dom.resolution,
units:dom.resolutionUnits});
Once you see this script, it's not hard to see what it is
doing.
This is the Fireworks generated script scaling just the
height of an
image to 400 px from 640x480 px.
fw.getDocumentDOM()
.scaleSelection(0.83281248807907104, 0.83333333333333337,
"autoTrimImages transformAttributes");
This works on all 640x480 images. Throw in a 700x480 and it
won't.
I'm assuming, very few people in here (myself included),
would be able
to transform this into something that would account for
varying widths
as senocular did.
SKB -
Hello everyone.
Can sb help me in creating the following script based on three tables:
id
col1
314
somevalue2
id
id1
col2
314
1
somevalue4
314
2
somevalue5
314
3
somevalue6
id
id1
id2
cod
qty
314
1
1
LTR
10
314
1
2
KG
20
314
2
1
LTR
40
The result should be like this:
id
id1
id2
cod_1
qty_1
cod2
qty_2
col1
col2
314
1
1
LTR
10
KG
20
somevalue2
somevalue4
314
2
1
LTR
40
somevalue2
somevalue5
Message was edited by: 933651Hi,
here's my view to this problem. Perhaps need some adjusting in join conditions when data model and data is clearer
create table t1 (
id number,
col1 varchar2(10)
insert into t1 values (314, 'somevalue2');
create table t2 (
id number,
id1 number,
col2 varchar2(10)
insert into t2 values (314, 1, 'somevalue4');
insert into t2 values (314, 2, 'somevalue5');
insert into t2 values (314, 3, 'somevalue6');
create table t3(
id number,
id1 number,
id2 number,
cod varchar2(3),
qty number
insert into t3 values (314, 1, 1, 'LTR', 10);
insert into t3 values (314, 1, 2, 'KG', 20);
insert into t3 values (314, 2, 1, 'LTR', 40);
with ltr as (
select id, id1, id2, cod, qty from
select id, id1, id2, cod as code, cod, qty from t3
pivot
sum(qty) for code in ('LTR' as qty)
where qty is not null
), kg as (
select id, id1, id2, cod, qty from
select id, id1, id2, cod as code, cod, qty from t3
pivot
sum(qty) for code in ('KG' as qty)
where qty is not null
select
t2.id,
t2.id1,
ltr.id2,
ltr.cod,
ltr.qty,
kg.cod,
kg.qty,
t1.col1,
t2.col2
from t2 join ltr on (
t2.id = ltr.id and t2.id1 = ltr.id1
) full join kg on (
t2.id = kg.id and t2.id1 = kg.id1
) left join t1 on (
t1.id = t2.id
order by id, id1
drop table t1 purge;
drop table t2 purge;
drop table t3 purge;
table T1 created.
1 rows inserted.
table T2 created.
1 rows inserted.
1 rows inserted.
1 rows inserted.
table T3 created.
1 rows inserted.
1 rows inserted.
1 rows inserted.
ID ID1 ID2 COD QTY COD QTY COL1 COL2
314 1 1 LTR 10 KG 20 somevalue2 somevalue4
314 2 1 LTR 40 somevalue2 somevalue5
table T1 dropped.
table T2 dropped.
table T3 dropped. -
Need help with simple python script (renaming and moving folder)
I have this script for use with sabnzbd, what it does is rename all folders in the desired directory, replacing any spaces with dots (example: Movie 2011 HD -> Movie.2011.HD).
#!/usr/bin/env python2
workdir = '/media/stuff/movies' #### CHANGE this line to your movie directory
for path, dirnames, filenames in os.walk(workdir):
print "path:", path
for dirname in dirnames:
if dirname.find(' ') > -1 :
# Yes, a space in the directory name, so replace it:
newname = dirname.replace(' ','.')
fulldirname = path + '/' + dirname
fullnewname = path + '/' + newname
print "Rename" , fulldirname, " ", fullnewname
os.rename(fulldirname, fullnewname)
What I would like it to do is 1. rename only the movie I run the script on (instead of /media/stuff/movies as above, the entire movie folder), and then 2. move the movie into /media/stuff/movies. Or vice versa! (I'd just prefer not to have it run on the entire movie directory).
Appreciate any help!Just my two cents:
I would not use walkdir but as usual a combination of find and python.
A simplified version of the script could look like this:
#!/usr/bin/python
# -*- coding: utf8 -*-
import os, shutil
# Define target dir
target_dir = "/media/stuff/movies/"
# Loop through all found files
for source_file in os.popen ("find ."):
# Remove \n
source_file = source_file[:-1]
extension = source_file[-3:]
# Only process video files
if (extension == 'mkv') or (extension == 'avi') or (extension == 'mp4'):
target_file = source_file.split('/')
target = target_file[len(target_file)-1]
target = target.replace(' ','.')
shutil.copy (source_file, targetdir + target)
Of course you might first want to print out instead of really copy files. -
Hello guys,
I am not sure whether my post has gone to the right section.
Its about a small script that I need.
Ok here is my issue. I am a student and in my department I have setup a PC (which is an old P4 system) which acts as a web server for a forum that can be accessed via LAN. The same PC hosts a Counter Strike Server which some 8 of us play at night for 1-2 hrs. So most of the time the system is idle. Well , then I thought I will use it for a good cause and installed folding@home , the distributed computing project. Now my counter strike server when idle uses 15.4% of CPU. The folding@home client uses more than 75% CPU. Now the problem is that after installing folding@home Counter Strike server FPS dropped and its unplayable.
I came along "cpulimit" which can decrease the percentage of usage for a specific program. So what I need is daemon/ script which
1. checks pid of 'hlds' (Counter Strike Server) and folding@home.
1. checks its usage
2. If usage of 'hlds' spikes above, lets say 17%, which means game has begun, the folding@home cpu usage should be brought down to less than 5%.
3. When the game is over and hlds comes back to <16% usage the folding@home client should throttle back to maximum and run for rest of the day.
I have been using Linux for 2 years but I have absolutely no idea of bash scripting. Can some kindly help how to tackle the above issue.
Thanks and Regards
--drtechie--dodo3773, Thanks a lot for that informative reply..
I modified the code a bit.
w=$( ps aux | sed /grep/d | grep -o cpulimit)
cpulimit is not running at boot and i didn't understand this.
And moreover
ps aux | sed /grep/d | grep hlds_amd
ps aux | sed /grep/d | grep FahCore_a4.exe
didn't output any numbers, but
ps aux | sed /grep/d | grep hlds_amd | awk '{print $3}'
did give me the %CPU.
And second thing is, I want to bring down usage of FahCore_a4.exe (folding@home) when %CPU usage of hlds_amd (gameserver) goes up a specific %. I made a smaller script and made it run by editing rc.local
The script
#!/bin/bash
while true; do
sleep 3
z=$ (ps aux | sed /grep/d | grep hlds_amd | awk '{print $3}' )
if [["$z" > "24.0" ]]; then
cpulimit -l 5 -p $ {pidof FahCore_a4.exe) -z
fi
done
This code does run and decreases usage of FahCore_a4.exe to 5% when hlds_amd usage goes above 24%
But with a small glitch. Once the cpulimit is applied the FahCore_a4.exe doesn't come back to normal even though hlds_amd usage goes below 24%.
I guess I am doing something wrong.
Maybe you are looking for
-
I am new to Apple and can't sync my music from laptop to Ipod touch even tho my laptop recognizes the Ipod. I haven't signed up for Itunes yet as I'm doing one thing at a time and don't see where Itunes is connected to syncing music. Also, if I bou
-
Youtube is not working properly Safari 6.0.1
Hello Experts, I'm having issues to watch videos in Youtube using Safari 6.0.1 I have currently running on OSX 10.8.2. Time to time youtube videos stop playing in the middle, it seems that it is a flash issue, but I'm also using the last version. I t
-
How to make labview real time understand sequence context
Does anyone know how to make Labview RT to understand teststand sequence context? My sequence context is defined as "TS.SequenceContext" as the screenshot in the attachment. If we need to point a VI for this Sequence Context then which VI from testst
-
Can't get duplex on Officejet 6480 to work with Mac OS 10.6.4
Recently purchased Macbook Pro 13 which makes me a new user. I have updated the OS to 10.6.4. Have installed Officejet J6480 and using wirelessly. Single page printing works fine. Can't get duplex printing to work. Checked options on printer in Syste
-
Hi, im new to java and im using a program called blue j. anyway heres my question. , I recommend you dont do the program for me, but rather help gear me in the right direction of things. In this program they want me to have it print out the # of doll