Scripting-Need Loop Help
Hi everyone!
I am trying to create a script to create a sales order (t-code VA01) with multiple line items.
My script code is using counter i to go down each row in excel to pull in the data (for each sales order),
but to create each line item within each sales order, i need it to read across a few columns so that i can make multiple line items.
Any ideas?
Hello Christina,
as far as I understand your problem correct, I think you need a loop in a loop.
Look at these example:
For i = 1 To RowCount
'First code here to fill your fields
For j = 1 To ColumnCount
'Second code here to make your multiple line items
Next j
Next i
Cheers
Stefan
Similar Messages
-
Need some help in debugging this exported script
Below is DDL generated by visio forward engineering tool . The example below consists of 2 test tables with one foreign key.
Forward engineering generated DDL script
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table1]') AND type in (N'U'))
DROP TABLE [dbo].[Table1]
GO
CREATE TABLE [dbo].[Table1] (
[test] CHAR(10) NOT NULL
, [test2] CHAR(10) NULL
GO
ALTER TABLE [dbo].[Table1] ADD CONSTRAINT [Table1_PK] PRIMARY KEY CLUSTERED (
[test]
GO
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table2]') AND type in (N'U'))
DROP TABLE [dbo].[Table2]
GO
CREATE TABLE [dbo].[Table2] (
[test2] CHAR(10) NOT NULL
GO
ALTER TABLE [dbo].[Table2] ADD CONSTRAINT [Table2_PK] PRIMARY KEY CLUSTERED (
[test2]
GO
GO
ALTER TABLE [dbo].[Table1] WITH CHECK ADD CONSTRAINT [Table2_Table1_FK1] FOREIGN KEY (
[test2]
REFERENCES [dbo].[Table2] (
[test2]
GO
GO
When i converted this DDL script using scratch editor the migration tool gave some errors can anyone help me to resolve below
DECLARE
v_temp NUMBER(1, 0) := 0;
BEGIN
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT *
FROM objects
WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table1]')*/
AND TYPE IN ( N'U' )
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
TRUNCATE TABLE Table1;
END IF;
END;
CREATE TABLE Table1
test CHAR(10) NOT NULL,
test2 CHAR(10)
ALTER TABLE Table1
ADD
CONSTRAINT Table1_PK PRIMARY KEY( test );
--SQLDEV:Following Line Not Recognized
DECLARE
v_temp NUMBER(1, 0) := 0;
BEGIN
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT *
FROM objects
WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table2]')*/
AND TYPE IN ( N'U' )
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
TRUNCATE TABLE Table2;
END IF;
END;
CREATE TABLE Table2
test2 CHAR(10) NOT NULL
ALTER TABLE Table2
ADD
CONSTRAINT Table2_PK PRIMARY KEY( test2 );
--SQLDEV:Following Line Not Recognized
ALTER TABLE Table1
ADD
CONSTRAINT Table2_Table1_FK1 FOREIGN KEY( test2 ) REFERENCES Table2 (test2)
--SQLDEV:Following Line Not Recognized
;Pl do not post duplicates - Need some help in debugging this script
-
Indesign CS5.5 Relink Script needs help
Hi, I'm trying to relink images in an InDesign CS5.5 file to a different server using a script. This is what I have so far, but when I run the script I get errors and can't relink because "Either the file does not exist, you do not have permission, or the file may be in use by another application". Does anyone know how to make this script work? I'm fairly new to scripting.
Here is the script I have:
tell application "Adobe InDesign CS5.5"
tell document 1
set linkList to links
set errInfo to "" -- We'll display error if we can't relink an item
repeat with x in linkList
if (x's status) is not normal then -- I usually check for any link that has an error
-- This should only return an AppleScript path with ":" separators
set linkPath to (x's file path) as string
if "Volumes/Calendars_2013 FPO" is in linkPath then
set AppleScript's text item delimiters to "Volumes/Calendars_2013 FPO"
set linkPath to (linkPath's text items) -- Create a list of text items
set AppleScript's text item delimiters to "Volumes/Calendars_2013"
set linkPath to (linkPath as string) -- Concatenate with new path
set AppleScript's text item delimiters to "" -- Reset TIDs
try
-- Need to make our string (path) into an alias path
relink x to alias linkPath
try
update x -- This can be helpful
end try
on error err
-- We'll store link name if error occurs
set errInfo to (errInfo & return & x's name)
end try
end if
end if
end repeat
-- If an error occurs while trying to relink, we'll display it
if (count errInfo) > 0 then display dialog ("Can't relink:" & errInfo)
end tell
end tell
--HectorI just tried adding collens to the end of the folder path. For some reason the script skipped the relink line. Below is the code with your update. I'm thinking its not finding the images because the script needs to make a list of all the images and choose the one that matches the missing image.
tell application "Adobe InDesign CS5.5"
tell document 1
set linkList to links
set errInfo to "" -- We'll display error if we can't relink an item
repeat with x in linkList
if (x's status) is not normal then -- I usually check for any link that has an error
-- This should only return an AppleScript path with ":" separators
set linkPath to (x's file path) as string
if "Calendars_2013 FPO:" is in linkPath then
set AppleScript's text item delimiters to "Calendars_2013 FPO:"
set linkPath to (linkPath's text items) -- Create a list of text items
set AppleScript's text item delimiters to "Calendars_2013:"
set linkPath to (linkPath as string) -- Concatenate with new path
set AppleScript's text item delimiters to "" -- Reset TIDs
try
-- Need to make our string (path) into an alias path
relink x to alias linkPath
try
update x -- This can be helpful
end try
on error err
-- We'll store link name if error occurs
set errInfo to (errInfo & return & x's name)
end try
end if
end if
end repeat
-- If an error occurs while trying to relink, we'll display it
if (count errInfo) > 0 then display dialog ("Can't relink:" & errInfo)
end tell
end tell
--Thanks for you help -
Hello i need a help about script to export translatable text strings from ai files and import them back after editing, thanks in advance
Lanny -
Thank you for taking the time to help with this problem. Can I just say however that as someone who has posted a first comment here and quite clearly never used a forum like this before, your comment unfortunately comes across as very excluding. It makes me feel there are a set of unwritten rules that I should know, and that I don't know them shows that the forum is not for me. In short, it's exactly the kind of response that stops people like me using forums like this.
I'm sure it's not intended to be received like this and I am sure that the way you have responded is quite normal in the rules of a forum like this. However, it is not normal for those of us who aren't familiar with forums and who only encounter them when they have a genuine problem. This is why I hope it is helpful to respond in full.
The reason I posted here is as follows. I was directed here by the apple support website. The original comment seemed to be the only one I could find which referred to my issue. As there is no obvious guidance on how to post on a forum like this it seemed perfectly reasonable to try and join in a conversation which might solve more than one problem at once.
Bee's reply however is both helpful and warm. This could in fact be a template for how new members should be welcomed and inducted into the rules of the forum in a friendly and inclusive way. Thank you very much indeed Bee! -
I need some help for an explanation. Loop for 1 minute.
int minute=1;
long currentTime=System.currentTimeMillis();
long stoppingTime = currentTime + (minute * 60 * 1000);
while (currentTime<stoppingTime) {
// do x;
currentTime=System.currentTimeMillis();
}I want to have the loop to run for 1 minute. It does not seem to work.
What did I miss? I need some help for an explanation.Ran:
class PrintTimeAsProcess {
public static void main(String[] argv) throws Exception {
int minute=1;
long currentTime=System.currentTimeMillis();
long stoppingTime = currentTime + (minute * 15 * 1000);
System.out.println("START Time: "+currentTime);
while (currentTime<stoppingTime) {
currentTime=System.currentTimeMillis();
System.out.println("END Time: "+currentTime);
}Got:
START Time: 1149278202718
END Time: 1149278217718
1149278217718
-1149278202718
15000 -
Working on slug script, need help!
Okay, this is not my script, one that I found online. The script works by allowing the user to set placeholders within the document and tag each placeholder with specific information such as DATE, TIME, FILENAME, etc.
The current placeholders that are setup for this script are:
{FILE}
{FILEPATH}
{FILENAME}
{FILEEXT}
{DATE}
{TIME}
I would like to add a few more placeholders, which is where I need some help. I would like to add a placeholder for the username or hostname, meaning computer name. {HOSTNAME}
I would also like to add a placeholder for colors used in the document listed in this format: PANTONE 186C, PANTONE 281C, BLACK, CYAN, MAGENTA, YELLOW, or as color swatches.
Also, is it possible to create a placeholder that will produce an interface allowing user input? Say you wanted a placeholder for Designer, and a dialog popped up asking for input.
Thanks for any help!
Here is the script:
var language="en"; // "de" fuer Deutsch
var WR="WR-DateAndTime v0.9\n\n";
var AIversion=version.slice(0,2);
if (language == "de") {
var format_preset = "{FILENAME}{FILEEXT} ({DATE} - {TIME})";
var MSG_unsetmark = WR+"Dieses Objekt ist als aktuelles Datum/Uhrzeit markiert, soll die Markierung aufgehoben werden?";
var MSG_setmark = WR+"Soll dieses Textobjekt als aktuelles Datum/Uhrzeit markiert werden?";
var MSG_askformat = WR+"Soll das Textobjekt als Datum/Uhrzeit formatiert werden? Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_editformat = WR+"Datums-/Uhrzeitformat bearbeiten (Leer = entfernen). Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_notexto = WR+"Kein Textobjekt!";
var MSG_selectedmany = "Zum Markieren als aktuelles Datum/Uhrzeit darf nur ein Textobjekt ausgew\xE4hlt sein und falls Sie die Daten aktualisieren wollen, darf kein Objekt ausgew\xE4hlt sein.";
var MSG_nodocs = WR+"Kein Dokument ge\xF6ffnet."
var Timeformat = 24;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "dd.mm.yyyy";
} else {
var format_preset = "{FILENAME} ({DATE}, {TIME})";
var MSG_unsetmark = WR+"This object is marked as actual date'n'time, do you want to remove the mark?";
var MSG_setmark = WR+"Do you want to mark the selected textobject as actual date'n'time?";
var MSG_askformat = WR+"Do you want to mark the textobject as actual date'n'time? Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_editformat = WR+"Edit date'n'time (empty = remove). Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_notexto = WR+"No textobject!";
var MSG_selectedmany = "To mark as actual date'n'time, you have to select only one textobject. If you want to update the date'n'time-objects, there must be no object selected.";
var MSG_nodocs = WR+"You have no open document."
var Timeformat = 12;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "mm/dd/yyyy";
var error=0;
if (documents.length<1) {
error++;
alert(MSG_nodocs)
if (error < 1) {
date_n_time();
function TodayDate()
var Today = new Date();
var Day = Today.getDate();
var Month = Today.getMonth() + 1;
var Year = Today.getYear();
var PreMon = ((Month < 10) ? "0" : "");
var PreDay = ((Day < 10) ? "0" : "");
if(Year < 999) Year += 1900;
var theDate = Dateformat.replace(/dd/,PreDay+Day);
theDate = theDate.replace(/mm/,PreMon+Month);
theDate = theDate.replace(/d/,Day);
theDate = theDate.replace(/m/,Month);
theDate = theDate.replace(/yyyy/,Year);
theDate = theDate.replace(/yy/,Year.toString().substr(2,2));
return theDate;
function TodayTime()
var Today = new Date();
var Hours = Today.getHours();
var Minutes = Today.getMinutes();
var Suffix = "";
if (Timeformat == 12) {
if (Hours >= 12 ) {
Suffix = PM;
} else {
Suffix = AM;
if (Hours >= 13) {
Hours = Hours - 12;
if (Hours < 1) {
Hours = Hours + 12;
var PreHour = ((Hours < 10) ? "0" : "");
var PreMin = ((Minutes < 10) ? "0" : "");
return PreHour+Hours+TimeSep+PreMin+Minutes+Suffix;
function DateUpdate(Name) {
var docpath = activeDocument.path.fsName;
var docname = activeDocument.name.replace(/(.*?)(?:\.([^.]+))?$/,'$1');
var extension = activeDocument.name.replace(/(.*?)(?:(\.[^.]+))?$/,'$2');
if (docpath.slice(2,3) == "\\") {
docsep = "\\";
} else {
docsep = ":";
var content = Name.slice(11);
var content = content.replace(/\{FILE\}/,docpath+docsep+docname);
var content = content.replace(/\{FILEPATH\}/,docpath);
var content = content.replace(/\{FILENAME\}/,docname);
var content = content.replace(/\{FILEEXT\}/,extension);
var content = content.replace(/\{DATE\}/,TodayDate());
var content = content.replace(/\{TIME\}/,TodayTime());
return content;
function date_n_time()
if (selection.length == 1) {
if (selection[0].typename == "TextArtItem" || selection[0].typename == "TextFrame") {
if (selection[0].name.slice(0,11) == "actualDate:") {
dateformat = selection[0].name.slice(11);
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_unsetmark );
} else {
dateformat = prompt(MSG_editformat, dateformat);
if(dateformat != "" && Check) {
selection[0].contents = selection[0].name.slice(11);
selection[0].name="";
selection[0].selected = false;
if(dateformat == "" && !Check) {
selection[0].name="";
selection[0].selected = false;
if(dateformat && dateformat !="" && !Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
} else {
dateformat = selection[0].contents;
if(dateformat.search(/\{DATE\}/) == -1 && dateformat.search(/\{TIME\}/) == -1 && dateformat.search(/\{FILE[A-Z]*\}/) == -1) dateformat = format_preset;
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_setmark );
} else {
dateformat = prompt(MSG_askformat, dateformat);
if (dateformat || Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
selection[0].selected = false;
} else {
alert ( MSG_notexto );
} else if (selection.length > 1) {
alert ( MSG_selectedmany );
} else {
if (AIversion == "10") {
var textArtItems = activeDocument.textArtItems;
for (var i = 0 ; i < textArtItems.length; i++)
if (textArtItems[i].name.slice(0,11) == "actualDate:") {
textArtItems[i].selected = true;
textArtItems[i].contents = DateUpdate(textArtItems[i].name);
} else {
var textFrames = activeDocument.textFrames;
for (var i = 0 ; i < textFrames.length; i++)
if (textFrames[i].name.slice(0,11) == "actualDate:") {
textFrames[i].selected = true;
textFrames[i].contents = DateUpdate(textFrames[i].name);Okay, here is the entire script with credit lines.
//////////////////////////////////////////////////////////// english //
// -=> WR-DateAndTime <=-
// A Javascript for Adobe Illustrator
// by Wolfgang Reszel ([email protected])
// Version 0.9 from 22.9.2011
// This script inserts the actual date or the actual time to a
// predefined position in the document.
// To define the position, you'll have to create an textobject and
// execute this script while the object is selected. The whole object
// has to be selected and not words or letters. You can mark more
// objects, if you select each object separate and execute
// the script on it.
// With the placeholders {DATE} and {TIME} you are able to define a
// particular point, where the date or the time should be replaced.
// If there is no placeholder in the textobject
// "{FILENAME}{FILEEXT} ({DATE}, {TIME})" will be used as standard placeholders.
// To update the date and time execute this script without any object
// selected.
// There are some additional placeholders:
// {FILE} - complete document-filename with path
// {FILEPATH} - only the documents filepath
// {FILENAME} - the filename of the document
// {FILEEXT} - the file extension of the document inclusive dot
// On my system this script can't see the path of the document, when
// it was opened directly from windows Explorer (double click).
// In Illustrator CS it is now possible to edit a DateAndTime-Object.
// To enable the english messages and date-format change the "de"
// into "en" in line 90.
// Sorry for my bad english. For any corrections send an email to:
// [email protected]
//////////////////////////////////////////////////////////// Deutsch //
// -=> WR-DateAndTime <=-
// Ein Javascript fuer Adobe Illustrator
// von Wolfgang Reszel ([email protected])
// Version 0.9 vom 30.9.2011
// Dieses Skript fuegt das aktuelle Datum und die aktuelle Uhrzeit an
// eine vorher bestimmte Stelle im Dokument ein.
// Um eine Stelle zu bestimmen, muss man ein Textobjekt erzeugen, es
// markieren und dann dieses Skript aufrufen. Es muss das gesamte Objekt
// ausgewaehlt sein, nicht etwa Buchstaben oder Woerter. Es lassen sich
// nacheinander auch mehrere Objekte als Datum/Uhrzeit markieren.
// Mit den Platzhaltern {DATE} und {TIME} (in geschweiften Klammern)
// kann man bestimmen, wo genau im Text das Datum und die Uhrzeit
// erscheinen soll. Sind die Platzhalter nicht vorhanden, wird
// automatisch "{FILENAME}{FILEEXT} ({DATE} - {TIME})" verwendet.
// Zum Aktualisieren des Datums/Uhrzeit muss man dieses Skript aufrufen
// wenn kein Objekt ausgewaehlt ist.
// Es gibt noch einige zusaetzliche Platzhalter:
// {FILE} - kompletter Dateiname mit Pfad
// {FILEPATH} - nur der Verzeichnispfad des Dokuments
// {FILENAME} - der Dateiname des Dokuments
// {FILEEXT} - die Dateiendung des Dokuments inklusive Punkt
// Auf meinem System kann der Pfad nicht ermittelt werden, wenn das
// Dokument vom Windows Explorer geoeffnet wird (Doppel-Klick).
// InÿIllustrator CSÿkann man nun ein Datum/Uhrzeit-Objekt bearbeiten.
// Um dieses Skript mit deutschen Meldungen und Datumsformat zu
// versehen, muss in Zeile 90 das "en" durch ein "de" ersetzt werden.
// Verbesserungsvorschlaege an: [email protected]
//$.bp();
var language="en"; // "de" fuer Deutsch
var WR="WR-DateAndTime v0.9\n\n";
var AIversion=version.slice(0,2);
if (language == "de") {
var format_preset = "{FILENAME}{FILEEXT} ({DATE} - {TIME})";
var MSG_unsetmark = WR+"Dieses Objekt ist als aktuelles Datum/Uhrzeit markiert, soll die Markierung aufgehoben werden?";
var MSG_setmark = WR+"Soll dieses Textobjekt als aktuelles Datum/Uhrzeit markiert werden?";
var MSG_askformat = WR+"Soll das Textobjekt als Datum/Uhrzeit formatiert werden? Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_editformat = WR+"Datums-/Uhrzeitformat bearbeiten (Leer = entfernen). Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_notexto = WR+"Kein Textobjekt!";
var MSG_selectedmany = "Zum Markieren als aktuelles Datum/Uhrzeit darf nur ein Textobjekt ausgew\xE4hlt sein und falls Sie die Daten aktualisieren wollen, darf kein Objekt ausgew\xE4hlt sein.";
var MSG_nodocs = WR+"Kein Dokument ge\xF6ffnet."
var Timeformat = 24;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "dd.mm.yyyy";
} else {
var format_preset = "{FILENAME} ({DATE}, {TIME})";
var MSG_unsetmark = WR+"This object is marked as actual date'n'time, do you want to remove the mark?";
var MSG_setmark = WR+"Do you want to mark the selected textobject as actual date'n'time?";
var MSG_askformat = WR+"Do you want to mark the textobject as actual date'n'time? Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_editformat = WR+"Edit date'n'time (empty = remove). Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_notexto = WR+"No textobject!";
var MSG_selectedmany = "To mark as actual date'n'time, you have to select only one textobject. If you want to update the date'n'time-objects, there must be no object selected.";
var MSG_nodocs = WR+"You have no open document."
var Timeformat = 12;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "mm/dd/yyyy";
var error=0;
if (documents.length<1) {
error++;
alert(MSG_nodocs)
if (error < 1) {
date_n_time();
function TodayDate()
var Today = new Date();
var Day = Today.getDate();
var Month = Today.getMonth() + 1;
var Year = Today.getYear();
var PreMon = ((Month < 10) ? "0" : "");
var PreDay = ((Day < 10) ? "0" : "");
if(Year < 999) Year += 1900;
var theDate = Dateformat.replace(/dd/,PreDay+Day);
theDate = theDate.replace(/mm/,PreMon+Month);
theDate = theDate.replace(/d/,Day);
theDate = theDate.replace(/m/,Month);
theDate = theDate.replace(/yyyy/,Year);
theDate = theDate.replace(/yy/,Year.toString().substr(2,2));
return theDate;
function TodayTime()
var Today = new Date();
var Hours = Today.getHours();
var Minutes = Today.getMinutes();
var Suffix = "";
if (Timeformat == 12) {
if (Hours >= 12 ) {
Suffix = PM;
} else {
Suffix = AM;
if (Hours >= 13) {
Hours = Hours - 12;
if (Hours < 1) {
Hours = Hours + 12;
var PreHour = ((Hours < 10) ? "0" : "");
var PreMin = ((Minutes < 10) ? "0" : "");
return PreHour+Hours+TimeSep+PreMin+Minutes+Suffix;
function DateUpdate(Name) {
var docpath = activeDocument.path.fsName;
var docname = activeDocument.name.replace(/(.*?)(?:\.([^.]+))?$/,'$1');
var extension = activeDocument.name.replace(/(.*?)(?:(\.[^.]+))?$/,'$2');
if (docpath.slice(2,3) == "\\") {
docsep = "\\";
} else {
docsep = ":";
var content = Name.slice(11);
var content = content.replace(/\{FILE\}/,docpath+docsep+docname);
var content = content.replace(/\{FILEPATH\}/,docpath);
var content = content.replace(/\{FILENAME\}/,docname);
var content = content.replace(/\{FILEEXT\}/,extension);
var content = content.replace(/\{DATE\}/,TodayDate());
var content = content.replace(/\{TIME\}/,TodayTime());
return content;
function date_n_time()
if (selection.length == 1) {
if (selection[0].typename == "TextArtItem" || selection[0].typename == "TextFrame") {
if (selection[0].name.slice(0,11) == "actualDate:") {
dateformat = selection[0].name.slice(11);
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_unsetmark );
} else {
dateformat = prompt(MSG_editformat, dateformat);
if(dateformat != "" && Check) {
selection[0].contents = selection[0].name.slice(11);
selection[0].name="";
selection[0].selected = false;
if(dateformat == "" && !Check) {
selection[0].name="";
selection[0].selected = false;
if(dateformat && dateformat !="" && !Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
} else {
dateformat = selection[0].contents;
if(dateformat.search(/\{DATE\}/) == -1 && dateformat.search(/\{TIME\}/) == -1 && dateformat.search(/\{FILE[A-Z]*\}/) == -1) dateformat = format_preset;
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_setmark );
} else {
dateformat = prompt(MSG_askformat, dateformat);
if (dateformat || Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
selection[0].selected = false;
} else {
alert ( MSG_notexto );
} else if (selection.length > 1) {
alert ( MSG_selectedmany );
} else {
if (AIversion == "10") {
var textArtItems = activeDocument.textArtItems;
for (var i = 0 ; i < textArtItems.length; i++)
if (textArtItems[i].name.slice(0,11) == "actualDate:") {
textArtItems[i].selected = true;
textArtItems[i].contents = DateUpdate(textArtItems[i].name);
} else {
var textFrames = activeDocument.textFrames;
for (var i = 0 ; i < textFrames.length; i++)
if (textFrames[i].name.slice(0,11) == "actualDate:") {
textFrames[i].selected = true;
textFrames[i].contents = DateUpdate(textFrames[i].name); -
Need urgent help with HSDIO hardware timing
Hi everyone,
I need urgent help regarding HSDIO hardware timing. I've been working in a project which generating serial ramp using HSDIO pxie device.
I'm using clock rate 40MHz and generating 14 bit of boolean for each step of ramp. And I have to generate simply 256 steps ramp.
Which means, 256 (steps) x 14 (boolean array) x 25 ns (period of 1 boolean value) = 89,6 ns.
What I'm doing right now is with using index of FOR loop as my input data (converting the index into 14bit boolean), then write into pxie device in every iteration,
which means, my data is getting into output in every 1ms time, right? (I'm using windows)
And I want to be able to generate faster than that.
How can I prewrite my 256 steps ramp, then write them all at once into pxie device. I'm really stuck here.
In the picture can you see how I do the write into device in every iteration of FOR Loop.
Regards,
Yan.hi, thanks for responding.
with using example of dynamic generation with script, I can manage to generate the ramp with controllable delay (generate the whole waveform, including delay with script command, then write to the card).
But I still have 1 question, I can test the output of the generation using oscilloscope and cant see the start delay (I'm writing delay at the start, before generating the ramp). My signal generated at 0 sec.
How can I check this start delay? is there any good example delivered with Labview to check this generation? Somehow I cant use the "dynamic generation and acquisition" example to see my generation (cant figure out how to capture the generated signal).
regards,
Yan. -
I Need Dire Help Making a Flash Form
Hello, I need some serious help creating a Flash Form.
I Have used a template from another site with the following
input boxes:
Name: __________
Email: __________
Comments: ____________
However, i had the script working fine, along with its php
script,
when i was trying to add more "text" boxes, i must have
messed the script up somhow.
When I submit that form, the name is send and email, but the
email is blank.. ie, there is no "comments"
here is the code:
on submit button:
on (release) {
// send variables in form movieclip (the textfields)
// to email PHP page which will send the mail
form.loadVariables("email.php", "POST");
sent email messege
onClipEvent(data){
// show welcome screen
_root.nextFrame();
and the php script (mailer.php)
php form email.pho
<?php
* PHP 4.1.0+ version of email script. For more
* information on the mail() function for PHP, see
http://www.php.net/manual/en/function.mail.php
// First, set up some variables to serve you in
// getting an email. This includes the email this is
// sent to (yours) and what the subject of this email
// should be. It's a good idea to choose your own
// subject instead of allowing the user to. This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.
$sendTo = "[email protected]";
$subject = "My Flash site reply";
// variables are sent to this PHP page through
// the POST method. $_POST is a global associative array
// of variables passed through this method. From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.
// header information not including sendTo and Subject
// these all go in one variable. First, include From:
$headers = "From: " . $_POST["firstName"] ." ".
$_POST["lastname"] . "<" . $_POST["email"] .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own. The return path here will
// often lift that restriction so, for instance, you could
send
// email to a hotmail account. (hosting provider settings may
vary)
// technically bounced email is supposed to go to the
return-path email
$headers .= "Return-path: " . $_POST["email"];
// now we can add the content of the message to a body
variable
$message = $_POST["message"];
// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);
?>
If anyone can see why the "comments" section is not being
sent?
Also: My original problem was how do you add more text boxes.
I want something like this:
Name:
Address:
Phone:
Mobile:
Email:
Website:
Comments:
Ive spent days and days trying to work out how to first make
a form that actually works, then add more text fields
Ive looked at many basic form tutorials, but they all seem to
only have 3 or 4 text fields.. Name, Email, Comments... etc
I haven't a clue how to edit the script both in action script
and php to add more fields easy.
I really need some help with this, its turning into a
nightmare for me.
I can provide someone with my .fla project file if they care
to take a look at what im doing wrong.
Thanks
Pan
ps. Please note: "$sendTo = "[email protected]";" =
this line i know i must put in my own email.This is all about timelines. It seems there is a movieclip
named 'form' (or possibly an actionscript object, can't tell). Any
variables created on that timeline are sent.
So you could have your new textfields on another timeline.
Or you could have textfields with no instance name in the
form timeline.
Those are the first two things to look at. Post the FLA and
we can tell you more specifically. -
Need some help...in need of a different way.
Hi, I'm new to Java and need some help. I have 2 questions that are similar in nature.
1st Question:
In a program that I'm writting I have a do-while loop which at the end brings up a dialog box that asks the user to enter '1' for 'Yes' or '2' for 'No' to continue.
I would rather have the option of having the user enter 'y' or 'Y' for Yes and 'n' or 'N' for No.
Here is what I have currently:
int x;
String data;
do{
//Blah blah code
data = JOptionPane.showInputDialog(null, "Enter 1 for Yes or 2 for No");
x = Integer.parseInt(data);
}while(x == 1);
x++;
2nd Question:
In another part of my program I have a Case statement that asks the user to enter a number or a letter from a list of choices. They can enter '2' , 't', or 'T'.
I would rather have all of this in an if-else chain. Is this possibe? if so, how would I do it.
Thanks.I would rather have the option of having the user enter 'y' or 'Y' for Yes and 'n' or
'N' for No. You can test the first letter of whatever the user inputs like this:String response = JOptionPane.showInputDialog(null, "Enter (Y)es or (N)o");
response = response.toLowerCase();
if(response.startsWith("y")) {
// the user entered something starting with y
} else if(response.startsWith("n")) {
// the user entered something starting with n
} else {
// what are you going to do?
}JOptionPane also has versions that would allow yes/no buttons. Eg, see:
http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html -
Anybody who can help me? I really need your help
I've tried to execute J2ee tutorial examples.
I don't know why this sample didn't execute...I've already finished to set up J2EE and enviornment variables.
I was trying this part from j2ee tutorial titled as "Packing Web modules".
Whenever I type "asant create-war" to make web modules in command window. I always got error.
Packaging Web Modules(From J2ee tutorial for your information)
A web module must be packaged into a WAR in certain deployment scenarios and whenever you want to distribute the web module. You package a web module into a WAR using the Application Server deploytool utility, by executing the jar command in a directory laid out in the format of a web module, or by using the asant utility. This tutorial allows you to use use either the first or the third approach. To build the hello1 application, follow these steps:
In a terminal window, go to <INSTALL>/j2eetutorial14/examples/web/hello1/.
Run asant build. This target will spawn any necessary compilations and will copy files to the <INSTALL>/j2eetutorial14/examples/web/hello1/build/ directory.
To package the application into a WAR named hello1.war using asant, use the following command:
asant create-war
This command uses web.xml and sun-web.xml files in the <INSTALL>/j2eetutorial14/examples/web/hello1 directory.
To learn how to configure this web application, package the application using deploytool by following these steps:
Start deploytool.
Create a web application called hello1 by running the New Web Component wizard. Select FileNewWeb Component.
In the New Web Component wizard:
Select the Create New Stand-Alone WAR Module radio button.
In the WAR File field, enter <INSTALL>/j2eetutorial14/examples/web/hello1/hello1.war. The WAR Display Name field will show hello1.
In the Context Root field, enter /hello1.
Click Edit Contents to add the content files.
In the Edit Contents dialog box, navigate to <INSTALL>/j2eetutorial14/examples/web/hello1/build/. Select duke.waving.gif, index.jsp, and response.jsp and click Add. Click OK.
Click Next.
Select the No Component radio button and click Next.
Click Finish.
Select FileSave.
A sample hello1.war is provided in <INSTALL>/j2eetutorial14/examples/web/provided-wars/. To open this WAR with deploytool, follow these steps:
Select FileOpen.
Navigate to the provided-wars directory.
Select the WAR.
Click Open Module.
I guess this step is for checking my system about setup information. I not sure how to change it.
the result from execution of ansnt command in dos
D:\J2ee\j2ee-1_4-doc-tutorial_7\j2eetutorial14\examples\web\hello1>asant create- war Buildfile: build.xml
j2ee-home-test:
BUILD FAILED D:\J2ee\j2ee-1_4-doc-tutorial_7\j2eetutorial14\examples\common\targets.xml:10: T he j2ee.home property is not properly set in <INSTALL>/j2eetutorial14/examples/c ommon/build.properties.
Set the j2ee.home property to the location of your Application Server installati on.
On Windows, you must escape any backslashes in the j2ee.home property with anoth er backslash or use forward slashes as a path separator. So, if your Application Server installation is C:\Sun\AppServer, you must set j2ee.home as follows:
j2ee.home = C:\\Sun\\AppServer
or
j2ee.home=C:/Sun/AppServer
j2ee.home is currently set to:
Total time: 0 seconds
D:\J2ee\j2ee-1_4-doc-tutorial_7\j2eetutorial14\examples\web\hello1>
I've installed J2ee sdk in C:\Sun\AppServer
PATH: %J2EE_HOME%\bin;%JAVA_HOME%\bin;
CLASSPATH: %J2EE_HOME%\lib\j2ee.jar;C:\Java\jre1.6.0_05\lib\ext\QTJava.zip;C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
J2EE_HOME: C:\Sun\AppServer
JAVA_HOME: C:\Sun\AppServer\jdk
I've installed J2ee with administration 4848, HTTP: 8089 HTTP: 8090
I guess this could refer the target.xml and build.properties. So, I've tried after changing some value, which is fit for my setup.
but, still doesn't work.
targets.xml
<path id="classpath">
<fileset dir="${j2ee.home}/lib">
<include name="j2ee.jar"/>
</fileset>
</path>
<target name="j2ee-home-test" >
<!-- Test if j2ee.home is set properly by looking for j2ee.jar -->
<available file="${j2ee.home}/lib/j2ee.jar" type="file" property="j2ee.jar.present" />
<fail unless="j2ee.jar.present">
The j2ee.home property is not properly set in <INSTALL>/j2eetutorial14/examples/common/build.properties.
Set the j2ee.home property to the location of your Application Server installation.
On Windows, you must escape any backslashes in the j2ee.home property with another backslash or use forward slashes as a path separator. So, if your Application Server installation is C:\Sun\AppServer, you must set j2ee.home as follows:
j2ee.home = C:\\Sun\\AppServer
or
j2ee.home=C:/Sun/AppServer
j2ee.home is currently set to: ${j2ee.home}
</fail>
</target>
<target name="clean" >
<delete dir="${build}" />
<delete dir="${dist}" />
<delete dir="${assemble}" />
<delete file="${ear.name}" />
<delete file="${war.name}" />
<delete file="${war.file}" />
<delete file="${client.jar.name}" />
</target>
<path id="db.classpath">
<fileset dir="${db.root}/lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="create-db_common"
depends="init,start-db,delete-db"
description="Create database tables and populate database." >
<sql driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.password}"
classpathref="db.classpath"
delimiter="${db.delimiter}"
autocommit="false"
onerror="abort" >
<transaction src="${sql.script}"/>
</sql>
</target>
<target name="delete-db"
description="Deletes the database tables." >
<sql driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.password}"
classpathref="db.classpath"
delimiter="${db.delimiter}"
autocommit="false"
onerror="continue" >
<transaction src="${delete.sql.script}"/>
</sql>
</target>
<target name="ping-db"
description="Checks to see if Derby is running." >
<java classname="org.apache.derby.drda.NetworkServerControl"
fork="yes"
resultproperty="db.ping.result">
<jvmarg line="${db.jvmargs}" />
<arg line="ping" />
<classpath refid="db.classpath" />
</java>
<condition property="db.running">
<equals arg1="${db.ping.result}" arg2="0" />
</condition>
</target>
<target name="start-db"
unless="db.running"
description="Starts the Derby databse server."
depends="ping-db">
<sun-appserv-admin
explicitcommand="start-database" />
</target>
<target name="stop-db"
description="Stops the Derby database server."
depends="ping-db"
if="db.running">
<sun-appserv-admin
explicitcommand="stop-database" />
</target>
<target name="admin_command_common">
<echo message="Doing admin task ${admin.command}"/>
<sun-appserv-admin
command="${admin.command}"
user="${admin.user}"
passwordfile="${admin.password.file}"
host="${admin.host}"
port="${admin.port}"
asinstalldir="${j2ee.home}" />
</target>
<target name="create-jdbc-resource_common">
<antcall target="admin_command_common">
<param name="admin.command"
value="create-jdbc-resource
--connectionpoolid ${conpool.name} ${jdbc.resource.name}" />
</antcall>
</target>
<target name="delete-jdbc-resource_common">
<antcall target="admin_command_common">
<param name="admin.command"
value="delete-jdbc-resource ${jdbc.resource.name}" />
</antcall>
</target>
<target name="deploy-war">
<antcall target="admin_command_common">
<param name="admin.command"
value="deploy ${war.file}" />
</antcall>
</target>
<target name="undeploy-war">
<antcall target="admin_command_common">
<param name="admin.command"
value="undeploy ${example}" />
</antcall>
</target>
<property environment="env" />
<target name="listprops"
description="Displays values of some of the properties of this build file">
<property file="../../common/admin-password.txt" />
<echo message="Path information" />
<echo message="j2ee.home = ${j2ee.home}" />
<echo message="j2ee.tutorial.home = ${j2ee.tutorial.home}" />
<echo message="env.Path = ${env.Path}" />
<echo message="env.PATH = ${env.PATH}" />
<echo message="" />
<echo message="Classpath information" />
<echo message="classpath = ${env.CLASSPATH}" />
<echo message="" />
<echo message="Admin information" />
<echo message="admin.password = ${AS_ADMIN_PASSWORD}" />
<echo message="admin.password.file = ${admin.password.file}" />
<echo message="admin.host = ${admin.host}" />
<echo message="admin.user = ${admin.user}" />
<echo message="admin.port = ${admin.port}" />
<echo message="https.port = ${https.port}" />
<echo message="" />
<echo message="Domain information" />
<echo message="domain.resources = ${domain.resources}" />
<echo message="domain.resources.port = ${domain.resources.port}" />
<echo message="" />
<echo message="Database information" />
<echo message="db.root = ${db.root}" />
<echo message="db.driver = ${db.driver}" />
<echo message="db.host = ${db.host}" />
<echo message="db.port = ${db.port}" />
<echo message="db.sid = ${db.sid}" />
<echo message="db.url = ${db.url}" />
<echo message="db.user = ${db.user}" />
<echo message="db.pwd = ${db.pwd}" />
<echo message="url.prop = ${url.prop}" />
<echo message="ds.class = ${ds.class}" />
<echo message="db.jvmargs = ${db.jvmargs}" />
</target>
build.properties ����
j2ee.home=
j2ee.tutorial.home=
asinstall.dir=${j2ee.home}
admin.password.file=${j2ee.tutorial.home}/examples/common/admin-password.txt
admin.host=localhost
admin.user=admin
admin.port=4848
https.port=8181
domain.resources="domain.resources"
domain.resources.port=8080
# Derby configuration settings
db.delimiter=;
db.root=${j2ee.home}/derby
db.driver=org.apache.derby.jdbc.ClientDriver
db.datasource=org.apache.derby.jdbc.ClientDataSource
db.host=localhost
db.port=1527
db.sid=sun-appserv-samples
db.url=jdbc:derby://${db.host}:${db.port}/${db.sid};create=true;
db.user=APP
db.pwd=APP
db.jvmargs=-ms16m -mx32m
Is there anyone who can tell me how to change it? I really need your help....
Thank you in advance.ok,
First of all make sure your tutorial folder is installed from the root:
C:\javaeetutorial5
or
D:\javaeetutorial5
it makes things so simple.
Secondly:
set your jee tutorial home
JAVAEE.TUTORIAL.HOME =
C:/javaeetutorial5
Thirdly: check in:
C:\javaeetutorial5\examples\bp-project
make a copy of the build.properties.sample save it as build.propropties, as a property file,
edit the properties file as in:
build.properties
As follows:
# uncomment the property javaee.home, and add the path
# to your GlassFish Java EE 5 SDK installation
javaee.home=c:/Sun/SDK
javaee.tutorial.home=c:/javaeetutorial5
# Uncomment the property j2ee.server.username,
# and replace the administrator username of the app-server
javaee.server.username=admin
# Uncomment the property j2ee.server.passwordfile,
# and replace the following line to point to a file that
# contains the admin password for your app-server.
# The file should contain the password in the following line:
AS_ADMIN_PASSWORD=admin1234and so fourth. Some of the settings as the application server name is all done for you
and then test it again.
Take care of editing the property file. It can give you headache.
Note also that this is for application server 9.1 - JEE5.
eve -
Please I need some help with a table
Hi All
I need some help with a table.
My table needs to hold prices that the user can update.
Also has a total of the column.
my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
I have tried using but as I need to set the toal with something like total
totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
Can any one please advise on some way I can get this to work ?
Thanks for reading
CraigHi there camickr
thanks for the help the other day
this is my full code....
package printing;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.swing.*;
import javax.swing.table.*;
import java.text.DecimalFormat;
public class tablePanel
extends JDialog implements Printable {
BorderLayout borderLayout1 = new BorderLayout();
private boolean printing = false;
private Dialog1 dialog;
JPanel jPanel = new JPanel();
JTable table;
JScrollPane scrollPane1 = new JScrollPane();
DefaultTableModel model;
private String[] columnNames = {
private Object[][] data;
private String selectTotal;
private double total;
public tablePanel(Dialog1 dp) {
dp = dialog;
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
public tablePanel() {
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
private void jbInit() throws Exception {
jPanel.setLayout(borderLayout1);
scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
this.add(jPanel);
jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
scrollPane1.getViewport().add(table);
jPanel.setOpaque(true);
newTable();
addToModel();
addRows();
setTotal();
public static void main(String[] args) {
tablePanel tablePanel = new tablePanel();
tablePanel.pack();
tablePanel.setVisible(true);
public void setTotal() {
total = 0;
int i = table.getRowCount();
for (i = 0; i < table.getRowCount(); i++) {
String name = (String) table.getValueAt(i, 1);
if (!"".equals(name)) {
if (i != table.getRowCount() - 1) {
double dt = Double.parseDouble(name);
total = total + dt;
String str = Double.toString(total);
table.setValueAt(str, table.getRowCount() - 1, 1);
super.repaint();
public void newTable() {
model = new DefaultTableModel(data, columnNames) {
table = new JTable() {
public Component prepareRenderer(TableCellRenderer renderer,
int row, int col) {
Component c = super.prepareRenderer(renderer, row, col);
if (printing) {
c.setBackground(getBackground());
else {
if (row % 2 == 1 && !isCellSelected(row, col)) {
c.setBackground(getBackground());
else {
c.setBackground(new Color(227, 239, 250));
if (isCellSelected(row, col)) {
c.setBackground(new Color(190, 220, 250));
return c;
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == 1) {
if (table.getSelectedColumn() == 1) {
table.setTableHeader(null);
table.setModel(model);
scrollPane1.getViewport().add(table);
table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
public void addToModel() {
Object[] data = {
"Price", "5800"};
model.addRow(data);
public void addRows() {
int rows = 20;
for (int i = 0; i < rows; i++) {
Object[] data = {
model.addRow(data);
public void printOut() {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(tablePanel.this);
pj.printDialog();
try {
pj.print();
catch (Exception PrintException) {}
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
int fontHeight = g2.getFontMetrics().getHeight();
int fontDesent = g2.getFontMetrics().getDescent();
//leave room for page number
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
double scale = 1;
if (tableWidth >= pageWidth) {
scale = pageWidth / tableWidth;
double headerHeightOnPage = 16.0;
//double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
//System.out.println("this is the hedder heigth " + headerHeightOnPage);
double tableWidthOnPage = tableWidth * scale;
double oneRowHeight = (table.getRowHeight() + table.getRowMargin()) * scale;
int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
double pageHeightForTable = oneRowHeight *numRowsOnAPage;
int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
if (pageIndex >= totalNumPages) {
return NO_SUCH_PAGE;
g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
//bottom center
g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages), (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
g2.translate(0f, headerHeightOnPage);
g2.translate(0f, -pageIndex * pageHeightForTable);
//If this piece of the table is smaller
//than the size available,
//clip to the appropriate bounds.
if (pageIndex + 1 == totalNumPages) {
int lastRowPrinted =
numRowsOnAPage * pageIndex;
int numRowsLeft =
table.getRowCount()
- lastRowPrinted;
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(oneRowHeight *
numRowsLeft));
//else clip to the entire area available.
else {
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(pageHeightForTable));
g2.scale(scale, scale);
printing = true;
try {
table.paint(g2);
finally {
printing = false;
//tableView.paint(g2);
g2.scale(1 / scale, 1 / scale);
g2.translate(0f, pageIndex * pageHeightForTable);
g2.translate(0f, -headerHeightOnPage);
g2.setClip(0, 0,
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(headerHeightOnPage));
g2.scale(scale, scale);
//table.getTableHeader().paint(g2);
//paint header at top
return Printable.PAGE_EXISTS;
class TableRenderDollar extends DefaultTableCellRenderer{
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean isFocused,
int row, int column) {
setHorizontalAlignment(SwingConstants.RIGHT);
Component component = super.getTableCellRendererComponent(
table,
value,
isSelected,
isFocused,
row,
column);
if( value == null || value .equals("")){
( (JLabel) component).setText("");
}else{
double number = 0.0;
number = new Double(value.toString()).doubleValue();
DecimalFormat df = new DecimalFormat(",##0.00");
( (JLabel) component).setText(df.format(number));
return component;
} -
Add a for each script to loop through HTTPService?
I'm using Flash Builder 4 with the Flex 4.1 SDK. I want to add a "for each" script to loop through my HTTPService XML file so only each nepName displays only once in my dropdown list. In my XML file I have multiple records associated with nepName. I would like ALL the records associated with each nepName to populate in my datagrid when it is selected from the dropdown. Currently in my dropdown there is a nepName entry for each XML tag. I hope I was able to explain that well enough. I'll try to put my code below so you can see everything I'm working with.
MXML:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="nepInfo.send()">
<s:layout>
<s:VerticalLayout horizontalAlign="center" paddingTop="25"/>
</s:layout>
<fx:Declarations>
<s:HTTPService id="nepInfo" url="http://www.epa.gov/owow/estuaries/nep_info.xml"/>
<!--s:RadioButtonGroup id="optiongroup"/-->
</fx:Declarations>
<s:Panel title="NEP Project Information">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:HGroup verticalAlign="middle">
<mx:Form x="188" y="34" width="338">
<mx:FormItem label="Search for NEP Information:">
<s:DropDownList enabled="true" id="dropDownList" prompt="Select NEP" dataProvider="{nepInfo.lastResult.records.record}" labelField="nepName">
</s:DropDownList>
</mx:FormItem>
</mx:Form>
</s:HGroup>
<mx:DataGrid id="resultsGrid"
dataProvider="{dropDownList.selectedItem}"
visible="{dropDownList.selectedItem != null}" x="20" y="62" width="1166" height="620">
<mx:columns>
<mx:DataGridColumn dataField="projectName" headerText="Project Name" wordWrap="true"/>
<mx:DataGridColumn dataField="projectDescription" headerText="Project Description" wordWrap="true"/>
<mx:DataGridColumn dataField="acres" headerText="Acres" wordWrap="true"/>
<mx:DataGridColumn dataField="habitatDescription" headerText="Habitat Description" wordWrap="true"/>
<mx:DataGridColumn dataField="neportCategory" headerText="Habitat Category" wordWrap="true"/>
<mx:DataGridColumn dataField="restorationType" headerText="Restoration Type" wordWrap="true"/>
<mx:DataGridColumn dataField="leadPartner" headerText="Lead Partner" wordWrap="true"/>
</mx:columns>
</mx:DataGrid>
</s:Panel>
</s:Application>
XML: http://www.epa.gov/owow/estuaries/nep_info.xml
Thank you in advance for your help!
-Alison($file, pwd);Assuming "pwd" is meant as the current directory, here a small example :
TEST@db102 SQL> create or replace procedure test_proc (p1 varchar2, p2 varchar2)
2 is
3 begin
4 dbms_output.put_line (p1||' '||p2);
5 end;
TEST@db102 SQL> /
Procedure created.
TEST@db102 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
$ ls -l /tmp/test/*.sql
-rw-r--r-- 1 ora102 dba 69 Apr 18 23:23 /tmp/test/file1.sql
-rw-r--r-- 1 ora102 dba 112 Apr 18 23:23 /tmp/test/file2.sql
-rw-r--r-- 1 ora102 dba 120 Apr 18 23:23 /tmp/test/file3.sql
$ cat test_proc.sh
DIR=/tmp/test
cd $DIR
ls *.sql | while read file
do
echo "Processing file $file"
sqlplus -s test/test << EOF
set feed off
set pages 0
set serveroutput on
exec test_proc('$file', '`pwd`');
exit
EOF
done
$ ./test_proc.sh
Processing file file1.sql
file1.sql /tmp/test
Processing file file2.sql
file2.sql /tmp/test
Processing file file3.sql
file3.sql /tmp/test
$ -
Need some help with a remove function
Design and code a program that will maintain a list of product names. Use a String type to represent the product name and an array of strings to implement the list. Your program must implement the following methods:
Add a product to the list
Remove a product from the list
Display then entire list
Find out if a particular product is on the list.
You need to create a command command loop with a menu() function. The program must continue asking for input until the user stops.
This is the assignment and this is what I have so far. I need some help writing the remove function.
Thanks
* Title: SimpleSearchableList.java
* Description: this example will show a reasonably efficient and
* simple algorithm for rearranging the value in an array
* in ascending order.
public class SimpleSearchableList {
private static String[] List = new String[25]; //These variables (field variables)
private static int Size; //are common to the entire class, but unavailable
//except to the methods of the class...
public static void main(String[] args)
String Cmd;
for(;;) {
Menu();
System.out.print("Command: ");
Cmd = SimpleIO.inputString();
if(Cmd.equals("Quit"))
break;
else if(Cmd.equals("Fill"))
FillList();
else if(Cmd.equals("Search"))
SearchList();
else if(Cmd.equals("Show"))
ShowList();
else if(Cmd.equals("Remove"))
Remove();
//Tells you what you can do...
public static void Menu()
System.out.println("Choices..................................");
System.out.println("\tFill to Enter Product");
System.out.println("\tShow to Show Products");
System.out.println("\tSearch to Search for Product");
System.out.println("\tRemove a Product");
System.out.println("\tQuit");
System.out.println(".........................................");
//This method will allow the user to fill an array with values...
public static void FillList()
int Count;
System.out.println("Type Stop to Stop");
for(Count = 0 ; Count < List.length ; Count++)
System.out.print("Enter Product: ");
List[Count] = SimpleIO.inputString();
if(List[Count].equals("Stop"))
break;
Size = Count;
//This method will rearrange the values in the array so that
// go from smallest to largest (ascending) order...
public static void SearchList()
String KeyValue;
boolean NotFoundFlag;
int Z;
System.out.println("Enter Product Names Below, Stop To Quit");
while(true)
System.out.print("Enter: ");
KeyValue = SimpleIO.inputString();
if(KeyValue.equals("Stop")) //Note the use of a method for testing
break; // for equality...
NotFoundFlag = true; //We'll assume the negative
for(Z = 0 ; Z < Size ; Z++)
if(List[Z].equals(KeyValue)) {
NotFoundFlag = false; //If we fine the name, we'll reset the flag
System.out.println(List[Z] + " was found");
if(NotFoundFlag)
System.out.println(KeyValue + " was not found");
//This method will display the contents of the array...
public static void ShowList()
int Z;
for(Z = 0 ; Z < Size ; Z++)
System.out.println("Product " + (Z+1) + " = " + List[Z]);
public static void Remove()
}I need help removing a product from the arrayYes. So what's your problem?
"Doctor, I need help."
"What's wrong?"
"I need help!"
Great.
By the way, you can't remove anything from an array. You'll have to copy the remaining stuff into a new one, or maybe maintain a list of "empty" slots. Or null the slots and handle that. The first way will be the easiest though. -
Need some help with a program Please.
Well, im new here, im new to java, so i need your help, i have to make a connect four program, my brother "Kind of" helped me and did a program for me, but the problem is i cant use some of those commands in the program and i have to replace them with what ive learned, so i will post the program and i will need your help to modify it for me.
and for these programs, also i want help for:
They have errors and i cant fix'em
the commands that i've leaned:
If statements, for loops, while loops,do while, strings, math classes, swithc statement, else if,logical operators,methods, one and two dimensional arrays.
Thanx in advance,
truegunner
// Fhourstones 3.0 Board Logic
// Copyright 2000-2004 John Tromp
import java.io.*;
class Connect4 {
static long color[]; // black and white bitboard
static final int WIDTH = 7;
static final int HEIGHT = 6;
// bitmask corresponds to board as follows in 7x6 case:
// . . . . . . . TOP
// 5 12 19 26 33 40 47
// 4 11 18 25 32 39 46
// 3 10 17 24 31 38 45
// 2 9 16 23 30 37 44
// 1 8 15 22 29 36 43
// 0 7 14 21 28 35 42 BOTTOM
static final int H1 = HEIGHT+1;
static final int H2 = HEIGHT+2;
static final int SIZE = HEIGHT*WIDTH;
static final int SIZE1 = H1*WIDTH;
static final long ALL1 = (1L<<SIZE1)-1L; // assumes SIZE1 < 63
static final int COL1 = (1<<H1)-1;
static final long BOTTOM = ALL1 / COL1; // has bits i*H1 set
static final long TOP = BOTTOM << HEIGHT;
int moves[],nplies;
byte height[]; // holds bit index of lowest free square
public Connect4()
color = new long[2];
height = new byte[WIDTH];
moves = new int[SIZE];
reset();
void reset()
nplies = 0;
color[0] = color[1] = 0L;
for (int i=0; i<WIDTH; i++)
height[i] = (byte)(H1*i);
public long positioncode()
return 2*color[0] + color[1] + BOTTOM;
// color[0] + color[1] + BOTTOM forms bitmap of heights
// so that positioncode() is a complete board encoding
public String toString()
StringBuffer buf = new StringBuffer();
for (int i=0; i<nplies; i++)
buf.append(1+moves);
buf.append("\n");
for (int w=0; w<WIDTH; w++)
buf.append(" "+(w+1));
buf.append("\n");
for (int h=HEIGHT-1; h>=0; h--) {
for (int w=h; w<SIZE1; w+=H1) {
long mask = 1L<<w;
buf.append((color[0]&mask)!= 0 ? " @" :
(color[1]&mask)!= 0 ? " 0" : " .");
buf.append("\n");
if (haswon(color[0]))
buf.append("@ won\n");
if (haswon(color[1]))
buf.append("O won\n");
return buf.toString();
// return whether columns col has room
final boolean isplayable(int col)
return islegal(color[nplies&1] | (1L << height[col]));
// return whether newboard lacks overflowing column
final boolean islegal(long newboard)
return (newboard & TOP) == 0;
// return whether newboard is legal and includes a win
final boolean islegalhaswon(long newboard)
return islegal(newboard) && haswon(newboard);
// return whether newboard includes a win
final boolean haswon(long newboard)
long y = newboard & (newboard>>HEIGHT);
if ((y & (y >> 2*HEIGHT)) != 0) // check diagonal \
return true;
y = newboard & (newboard>>H1);
if ((y & (y >> 2*H1)) != 0) // check horizontal -
return true;
y = newboard & (newboard>>H2); // check diagonal /
if ((y & (y >> 2*H2)) != 0)
return true;
y = newboard & (newboard>>1); // check vertical |
return (y & (y >> 2)) != 0;
void backmove()
int n;
n = moves[--nplies];
color[nplies&1] ^= 1L<<--height[n];
void makemove(int n)
color[nplies&1] ^= 1L<<height[n]++;
moves[nplies++] = n;
public static void main(String argv[])
Connect4 c4;
String line;
int col=0, i, result;
long nodes, msecs;
c4 = new Connect4();
c4.reset();
BufferedReader dis = new BufferedReader(new InputStreamReader(System.in));
for (;;) {
System.out.println("position " + c4.positioncode() + " after moves " + c4 + "enter move(s):");
try {
line = dis.readLine();
} catch (IOException e) {
System.out.println(e);
System.exit(0);
return;
if (line == null)
break;
for (i=0; i < line.length(); i++) {
col = line.charAt(i) - '1';
if (col >= 0 && col < WIDTH && c4.isplayable(col))
c4.makemove(col);
By the way im using Ready to program for the programming.You can't really believe that his brother did this
for him...I did miss that copyright line at the beginning when
I first looked it over, but you know, if it had been
his brother, I'd be kinda impressed. This wasn't a
25 line program. It actually would have required
SOME thought. I doubt my brother woulda done that
for me (notwithstanding the fact that I wouldn't need
help for that program, and my brother isn't a
programmer).I originally missed the comments at the top but when I saw the complexity of what was written then I knew that it was too advanced for a beginner and I relooked through the code and saw the comments. -
In Need of Help Creating an Action
Hello,
I need to create several thousand QR codes and I am trying to work out how to automate it so that I don't have to make them one at a time.
My idea was to download the EVEnX QR Code plugin for Photoshop and then make an action, or series of actions, to make the codes en mass. The information I need in each QR Code is a URL, with each code having a unique one that links to the products serial number.
So, I created a file roughly the size of the QR codes I needed and used vairables to insert the URL on text layer. I was hoping to be able to create an action that would copy that text, open the plugin (which works like a filter), paste the text, create the code and save/close the image.
However, I can't seem to get it to work. I don't know how to make an action to have it highlight the text layer or an action to paste it into the plugin.
Also, the plugin allows you to make a variable of certain information it pulls from the file but the closest I can get to what I need is file name, however I can't make the files named for the URL because of the slashes. They allows you to use file name, file path and the information like size and date.
Sorry for the long post but I HAVE to get this figured out as this project is for work and I am on a time limit. I don't have to use an action, any other way would be fine! I don't have much experience with scripts but if you can walk me through one that would work then I would be happy to try! PLEASE HELP!!!
Thanks!
In Need of Help Creating an ActionHave you checked out Image > Variables and the Help chapter »Creating data-driven graphics« yet?
Maybe you are looking for
-
Question about installing and removing Windows on Mac OS X
Forgive me for asking this because the answer is probably extremely simple, but I just wanted to make sure. If I use Boot Camp to install windows XP or 7 onto my Mac (OS X), then if I choose to remove windows and repartition my mac into one hard driv
-
Item & for schedule line & is in the work area
Hi All, We added some custom fields on the schedule line tab and also in VBEP table. For thie same we also added code in the PBO module of SAPMV45A/4500 screen#. Since we added the code we are getting the error message# V1357 with description 'Item 0
-
My pdf version of a book I ordered from Blurb tries to open in digital editions 2 but only shows me random pages. It cannot "read" the book page by page. Any suggestions?
-
[Solved] Boot messages waiting 10 secodns for device...
Hello. When i'm boot my arch i got message waiting 10 secdonds for device /dev/sda1 (arch partition). I have in mkinitcpio this modules: ahci ext4 scsi_mod sd_mod libata. That's all what can i do run arch wihout waiting 10 secodns? Last edited by Spe
-
Has the width and colour of the graduated filter changed in Lightroom 5.4?
Hi, Has the width and colour of the graduated filter changed in Lightroom 5.4? The 3 lines seem to be too narrow, almost a hairline, and not white enough. I can barely see them on a calibrated monitor and did not have that problem before upgrading to