Trouble looping
Hi, I've been given a crash course in java but now have to complete a random shapes program and I have 2 main problems - I've managed to create an infinite loop and I appear to expect two entries of shape name instead of one. I'm baffled and have been staring at this for ten hours - at this stage I think I'm making it worse. Any help would be greatly appreciated.
import java.util.Random;
import java.lang.*;
public class Tester {
private static RandomShapeGenerator gen = new RandomShapeGenerator();
public static void printMenu(){
System.out.println("Please choose one of the following options ");
System.out.println("1. Show shapes details ");
System.out.println("2. Modify shape dimensions ");
System.out.println("3. Modify shape colour ");
System.out.println("4. Move shape to a location ");
System.out.println("5. Exit ");
System.out.println("*******************************************");
public static String checkTypeOfObject(Object obj){//instance of an object- review notes
if (obj instanceof Circle)
return "Circle";
else if (obj instanceof Square)
return "Square";
else if(obj instanceof Rectangle)
return "Rectangle";
else if(obj instanceof Ellipse)
return "Ellipse";
else if(obj instanceof Triangle)
return "Triangle";
else
return "";
public static void main(String[] args) {
boolean done = false;
int userOption;
System.out.println("*******************************************");
System.out.println("** Shape Project ** ");
System.out.println("* Author: * ");
System.out.println("*******************************************");
System.out.println("About to Create random Shapes... Please wait...\n\n");
{ Shape[] s = new Shape[5];
// Fill up the array with shapes:
for (int i = 0; i < s.length; i++)
s[i] = gen.next();
// Make polymorphic method calls:
for (int i = 0; i < s.length; i++)
s.getMyDetails();
while(!done){System.out.println("Please Enter name of shape you wish to modify or view: ");
String shapeName=Console.readString();
Shape shapeToModify;
boolean found =false;
if(!found)
System.out.println("** Shape NOT Found **");
for (int j=0; j < s.length; j++){
shapeToModify =s[j];
shapeName = shapeToModify.getName();
if(shapeName.equalsIgnoreCase(shapeName.trim())){
System.out.println("** Shape Found **");
found =true;
printMenu();
userOption = Console.readInt();
//try{
if (userOption == 5)
done = true;
{ System.out.println("** Exiting... **");
System.out.println("** Goodbye **");
if(userOption == 1)
{ shapeToModify.getMyDetails();
else if (userOption == 2)
{ if(checkTypeOfObject(shapeToModify).equals("Circle"))
{System.out.print("Please enter the radius: ");
double Input = Console.readDouble();
Circle circle1 =(Circle)shapeToModify;
circle1.setRadius(Input);
System.out.print("Sucessfully changed dimensions of circle : Details are ..\n ");
circle1.getMyDetails();
userOption = 0;
if(checkTypeOfObject(shapeToModify).equals("Square"))
{System.out.print("Please enter the length: ");
Double length = Console.readDouble();
//System.out.print("Please enter the width: ");
//String width = Console.readDouble();
Square square1 =(Square)shapeToModify;
square1.setLength(length);
//square1.setWidth((new Double(width).doubleValue()));
System.out.print("Sucessfully changed dimensions of square : Details are ..\n ");
square1.getMyDetails();
if(checkTypeOfObject(shapeToModify).equals("Rectangle"))
{System.out.print("Please enter the length: ");
Double length = Console.readDouble();
System.out.print("Please enter the width: ");
Double width = Console.readDouble();
Rectangle rectangle1 =(Rectangle)shapeToModify;
rectangle1.setwidth(length);
rectangle1.setHeight(width);
System.out.print("Sucessfully changed dimensions of rectangle : Details are ..\n ");
rectangle1.getMyDetails();
if(checkTypeOfObject(shapeToModify).equals("Triangle"))
{System.out.print("Please enter the length: ");
Double length = Console.readDouble();
System.out.print("Please enter the height: ");
Double height = Console.readDouble();
System.out.print("Please enter the width: ");
Double width = Console.readDouble();
Triangle triangle1 =(Triangle)shapeToModify;
triangle1.setLength(length);
triangle1.setHeight(height);
triangle1.setWidth(width);
System.out.print("Sucessfully changed dimensions of triangle : Details are ..\n ");
triangle1.getMyDetails();
if(checkTypeOfObject(shapeToModify).equals("Ellipse"))
{System.out.print("Please enter the MajorAxis: ");
Double semiMajorAxis = Console.readDouble();
System.out.print("Please enter the MinorAxis: ");
Double semiMinorAxis = Console.readDouble();
Ellipse ellipse1 =(Ellipse)shapeToModify;
ellipse1.setSemiMajorAxis(semiMajorAxis);
ellipse1.setSemiMinorAxis(semiMinorAxis);
System.out.print("Sucessfully changed dimensions of triangle : Details are ..\n ");
ellipse1.getMyDetails();
else if (userOption == 3)
{ System.out.print("Please enter a colour: ");
String colour = Console.readString();
shapeToModify.setColour(colour.trim());
System.out.print("Sucessfully changed dimensions : Details are ..\n ");
shapeToModify.getMyDetails();
else if (userOption == 4)
System.out.print("Please enter the xCooridinate: ");
int x = Console.readInt();
System.out.print("Please enter the yCoordinate: ");
int y = Console.readInt();
Coordinate coordinate =shapeToModify.getLocation();
coordinate.setXCoOrdinate(x);
coordinate.setYCoOrdinate(y);
System.out.print("Sucessfully changed coordinate : Details are ..\n ");
shapeToModify.getMyDetails();
else if ((1 < userOption) | (userOption > 5));
{ System.out.println("Sorry, that is not a valid value. Please try again.");
/*catch(Exception ex)
System.out.println("ERROR - Exiting...."); }
class RandomShapeGenerator {
private Random rand = new Random();
private String[] names =new String[]{"Shape1","Shape2","Shape3","Shape4","Shape5"};
private String[] colours =new String[]{"white","red","indigo","black","purple"};
private double[] widthArray =new double[]{10.00,11.00,12.00,13.00,14.00,15.00};
private double[] heightArray =new double[]{10.00,11.00,12.00,13.00,14.00,15.00};
private double[] lengthArray =new double[]{10.00,11.00,12.00,13.00,14.00,15.00};
private double[] radiusArray =new double[]{10.00,11.00,12.00,13.00,14.00,15.00};
private double[] majorAxisArray =new double[]{10.00,11.00,12.00,13.00,14.00,15.00};
private double[] minorAxisArray =new double[]{10.00,11.00,12.00,13.00,14.00,15.00};
public Shape next() {
switch (rand.nextInt(5)) {
default:
case 0:
return new Circle(radiusArray[2],names[5],colours[3],new Coordinate(0,0));
case 1:
return new Square(lengthArray[1], widthArray[2],names[1],colours[1],new Coordinate(0,0));
case 2:
return new Triangle(lengthArray[2],heightArray[2],widthArray[3],names[2],colours[2],new Coordinate(0,0));
case 3:
return new Rectangle (lengthArray[3],heightArray[3],names[0],colours[0],new Coordinate(0,0));
case 4:
return new Ellipse (majorAxisArray[4],minorAxisArray[4],names[4],colours[4],new Coordinate(0,0));
I can't seem to duplicate the read error but this will show you what I mean about the shape name. The array that creates shapes calls them "Shape1" to "Shape5". This says 'shape found' for anything you type in. I'm sure I'm doing something silly but I can't see it.
public class errors {
private static RandomShapeGenerator gen = new RandomShapeGenerator();
public static void main(String[] args) {
boolean done = false;
int userOption;
{ Shape[] s = new Shape[5];
// Fill up the array with shapes:
for (int i = 0; i < s.length; i++)
s[i] = gen.next();
// Make polymorphic method calls:
for (int i = 0; i < s.length; i++)
s.getMyDetails();
{System.out.println("Please Enter name of shape you wish to modify or view: ");
String shapeName=Console.readString();
Shape shapeToModify;
boolean found =false;
// if(!found)
for (int j=0; j < s.length; j++){
shapeToModify =s[j];
shapeName = shapeToModify.getName();
if(shapeName.equalsIgnoreCase(shapeName.trim())){
System.out.println("** Shape Found **");
found =true;}
else {System.out.println("** Shape NOT Found **");
break;}
printMenu();
userOption = Console.readInt();
if(userOption == 1)
{ shapeToModify.getMyDetails();
Similar Messages
-
Trouble looping thru SR to mark as completed with powershell
Not sure this is actually a SCSM question, but I only seem to have trouble doing this in SCSM PowerShell.
PS D:\ps1\Management Scripts> gc D:\ps1\SRs2Close_6.23.2014.txt
SR6172
SR6411
SR6159
SR6284
SR6280
SR6298
SR6226
SR6262
SR6307
SR6223
SR6264
SR6285
SR6334
SR6255
SR6251
SR6247
SR6238
SR6234
SR6231
SR6200
SR6165
$SRs = gc D:\ps1\SRs2Close_6.23.2014.txt
Errors:
ERRORS:
PS D:\ps1\Management Scripts> $SRs | foreach-object {"D:\PS1\Management Scripts\Set-SRStatus.ps1" $_ "Completed"}
Unexpected token '_' in expression or statement.
At line:1 char:71
+ $SRs | foreach-object {"D:\PS1\Management Scripts\Set-SRStatus.ps1" $_ <<<< "Completed"}
+ CategoryInfo : ParserError: (_:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
PS D:\ps1\Management Scripts> $SRs | foreach-object {"D:\PS1\Management Scripts\Set-SRStatus.ps1" $_.name.tostring() "Completed"}
Unexpected token '_' in expression or statement.
At line:1 char:71
+ $SRs | foreach-object {"D:\PS1\Management Scripts\Set-SRStatus.ps1" $_ <<<< .name.tostring() "Completed"}
+ CategoryInfo : ParserError: (_:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
PS D:\ps1\Management Scripts> foreach ($SR in $SRs) {"D:\PS1\Management Scripts\Set-SRStatus.ps1" $SR.tostring() "Completed"}
Unexpected token 'SR' in expression or statement.
At line:1 char:72
+ foreach ($SR in $SRs) {"D:\PS1\Management Scripts\Set-SRStatus.ps1" $SR <<<< .tostring() "Completed"}
+ CategoryInfo : ParserError: (SR:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
Script:
param([string]$SRID,[string]$Status)
$a = (get-module|%{$_.name}) -join " "
if(!$a.Contains("SMLets")){Import-Module 'smlets' -ErrorVariable err -Force}
$SRobj = Get-SCSMObject -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "ID -eq $SRID"
Set-SCSMObject -SMObject $SRobj -Property Status -Value $Status
PS D:\ps1\Management Scripts> Get-SCSMObject -Class $SRClass -Filter "ID -eq SR6172" | select status
Status
In Progress
PS D:\ps1\Management Scripts> $SRobj = Get-SCSMObject -Class $SRClass -Filter "ID -eq SR6172"
PS D:\ps1\Management Scripts> Set-SCSMObject -SMObject $SRobj -Property status -Value Completed
PS D:\ps1\Management Scripts> Get-SCSMObject -Class $SRClass -Filter "ID -eq SR6172" | select status
Status
Completed
PS D:\ps1\Management Scripts> $SRs = gc D:\ps1\SRs2Close_6.23.2014.txt
PS D:\ps1\Management Scripts> $SRs | ForEach-Object {& 'D:\ps1\Management Scripts\Set-SRStatus.ps1' "$_" "Completed"}
Get-SCSMObject : Id='SR6411' -- Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
At D:\ps1\Management Scripts\Set-SRStatus.ps1:6 char:24
+ $SRobj = Get-SCSMObject <<<< -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "ID -eq $SRID"
+ CategoryInfo : NotSpecified: (:) [Get-SCSMObject], UnknownDatabaseException
+ FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.UnknownDatabaseException,SMLets.GetSMObjectCommand
Get-SCSMObject : Id='SR6159' -- Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
At D:\ps1\Management Scripts\Set-SRStatus.ps1:6 char:24
+ $SRobj = Get-SCSMObject <<<< -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "ID -eq $SRID"
+ CategoryInfo : NotSpecified: (:) [Get-SCSMObject], UnknownDatabaseException
+ FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.UnknownDatabaseException,SMLets.GetSMObjectCommand
Get-SCSMObject : Id='SR6284' -- Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
At D:\ps1\Management Scripts\Set-SRStatus.ps1:6 char:24
+ $SRobj = Get-SCSMObject <<<< -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "ID -eq $SRID"
+ CategoryInfo : NotSpecified: (:) [Get-SCSMObject], UnknownDatabaseException
+ FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.UnknownDatabaseException,SMLets.GetSMObjectCommand
Get-SCSMObject : Id='SR6280' -- Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
At D:\ps1\Management Scripts\Set-SRStatus.ps1:6 char:24
+ $SRobj = Get-SCSMObject <<<< -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "ID -eq $SRID"
+ CategoryInfo : NotSpecified: (:) [Get-SCSMObject], UnknownDatabaseException
+ FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.UnknownDatabaseException,SMLets.GetSMObjectCommand
Get-SCSMObject : Id='SR6298' -- Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
At D:\ps1\Management Scripts\Set-SRStatus.ps1:6 char:24
+ $SRobj = Get-SCSMObject <<<< -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "ID -eq $SRID"
+ CategoryInfo : NotSpecified: (:) [Get-SCSMObject], UnknownDatabaseException
+ FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.UnknownDatabaseException,SMLets.GetSMObjectCommand
PS D:\ps1\Management Scripts>
I got this to work previously, I just can't remember how...?
Joshua FuenteThat's whats driving me "batty".
It works from the console.
PS D:\ps1\Management Scripts> Get-SCSMObject -Class $SRClass -Filter "ID -eq SR6172" | select status
Status
Completed
I tried changing the script to a function, but didn't have any luck.
I will try with the name param and see if that helps.
Like I said, I have done this before, it just seems like it different every time.
So I changed the script to this,
param([string]$SRID,[string]$Status)
$a = (get-module|%{$_.name}) -join " "
if(!$a.Contains("SMLets")){Import-Module 'smlets' -ErrorVariable err -Force}
Get-SCSMObject -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "Id -eq $SRID" | Select ID, Name, Status
And it works fine
PS D:\ps1\Management Scripts> $SRs | ForEach-Object {.\Set-SRStatus.ps1 $_}
Id Name Status
SR6172 SR6172 Completed
SR6411 SR6411 In Progress
SR6159 SR6159 In Progress
SR6284 SR6284 In Progress
SR6280 SR6280 In Progress
SR6298 SR6298 In Progress
SR6226 SR6226 In Progress
SR6262 SR6262 In Progress
SR6307 SR6307 In Progress
SR6223 SR6223 In Progress
SR6264 SR6264 In Progress
SR6285 SR6285 In Progress
SR6334 SR6334 In Progress
SR6255 SR6255 In Progress
SR6251 SR6251 In Progress
SR6247 SR6247 In Progress
PS D:\ps1\Management Scripts>
And add on the Set-SCSMobj
param([string]$SRID,[string]$Status)
$a = (get-module|%{$_.name}) -join " "
if(!$a.Contains("SMLets")){Import-Module 'smlets' -ErrorVariable err -Force}
Get-SCSMObject -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "Id -eq $SRID" | Set-SCSMObject -Property Status -Value $Status
And now it works...
PS D:\ps1\Management Scripts> $SRs | ForEach-Object {.\Set-SRStatus.ps1 $_ completed}
No errors, and all SRs show completed. -
10.4.7 update trouble Looping on Login App
Hi All Last night I set all the computers at my company to update to 10.4.7, via the downloaded combo updater. All the computers are fine save for one.
On this computer it will not finish booting.
so far I have
Run disk repair and premissions repair from the disk utility via install disk.
run fsck via single user mode
attempted to boot in safe mode
When I turn on verbose mode for the start up the boot process seems to be looping on
/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow: Login Window Application Started
over and over again I've let it run for up to 30 mins like this before restarting by holding the power buttong for 4 sec
Just wanted to know if there is anything I can do or if I should just reinstall tiger and than update again.Can you mount the drive from another computer via FireWire Target Disk Mode? then repair the drive; delete cache folders etc.
From single user mode you could also try to rename
~/Library/Preferences to another name.
MacFixit: Repairing Permissions
General Troubleshooting permissions
Troubleshooting Mac OS X
Insufficient disk space or RAM
Installing Software Update
Advice on Archive & Install -
Trouble looping through XML file
I've got the following code which loops through an XML file. It works when there are multiple devices in the XML file and the COMPUTER node in the script includes [$i] but if only one device is in the network (thus only one in the XML file) then I have to
remove the [$i]. What am I doing wrong to make it apply to both?
$i = 0
foreach ($COMPUTER in $settings.Settings.Setting.COMPUTERS.COMPUTER) {
# IP for Computer
$IPADDRESS = $settings.Settings.Setting.COMPUTERS.COMPUTER[$i].COMPUTERIP
# Username for Computer
$USERNAME = $settings.Settings.Setting.COMPUTERS.COMPUTER[$i].USERNAME
# Credentials file
$CREDFILE = $settings.Settings.Setting.COMPUTERS.COMPUTER[$i].CRED
# Do things here using the variables declared above
$i= $i+1
} # Stop looping
I should point out that I've changed the variable and XML names accordingly but the principle is the same.
Thanks in advanceHi Bobbins,
no, I just pasted that there so you can copy&paste it to the console and see the results. External XML sources are totally valid.
To apply this to your initial script example, replace all instances of ...
$settings.Settings.Setting.COMPUTERS.COMPUTER[$i]
... with ...
$COMPUTER
Cheers,
Fred
There's no place like 127.0.0.1 -
Whiteout conditions here in the northeast, it's a Blizzard!
Hopefully this helps someone because I was banging my head against the wall trying to figure this out.
This is for people who want to precisely loop (or edit in other ways) multiple clips in the exact same way, but that are on seperate tracks playing concurrently in Multi-track view, so for instance looping 3 different tracks recorded simultaneously from a drum machine and keeping the same exact placement of each track relative to each other when trying to get the loop right (or any other type of edit)
It's all about how you switch between Edit view and Multi-track view, and you CAN'T group your clips before going to edit view, although this is counter-intuitive.
The basic jist is simple, "Selections" in the timeline, transfer from Multi-Track to Edit View and Back to Multi-Track...but you most follow a certain procedure, here is the procedure:
WARNING: THIS WILL ONLY WORK IF THE SELECTION IS OF ONE CLIP PER TRACK!!! YOU CANNOT MAKE A TIMELINE SELECTION OF MULTIPLE CLIPS ON A TRACK AND HAVE THAT TIMELINE SELECTION TRANSFER TO EDIT VIEW, AS FAR AS I KNOW.
In Multi-Track view:
1) Switch the timeline to "Samples"
2) Make a "Selection" of the part you want to Loop and zoom all the way in to the start and end points to get the loop as precise as possible, if it's not perfect don't worry just get it as good as possible in Multi-track View, then in Edit View you can find the Zero-Crossing points.
3) Make sure the clips you want to edit are NOT GROUPED AT THIS POINT
Here is the part that got me - AFTER making your Selection in Multi-Track view - you have to go to Edit view in a certain way, so that you don't de-select your selection:
WARNING: Do NOT Double-Click the clip/file you want to Edit!!! Do not double left-click anywhere in MultiTrack View or you will de-select your selection.
note: You have to edit the files one at a time in Edit View, but if you go there using the correct procedure, you can transfer your selection you made in Multi-Track view.
4) Decide which clip is the hardest to one to loop (usually it's an instrument sample rather then a drum loop but you never know)
5) Instead of double-clicking a clip to Edit it, HOLD CONTROL AND LEFT CLICK THE CLIP YOU WANT TO EDIT ONE TIME, this will select the clip without de-selecting your TIMELINE SELECTION.
6) Now that the clip you want to edit is selected, You want to go to Edit View USING ONE ROUTE ONLY --> Simply click "Edit View"
^Make sure you Timeline selection is still in place and hasn't moved do to user error (e.g. accidentally clicking the timeline or shift-clicking and moving the selection by accident <--- which I do by accident when attempting to control+click)
7) If you followed the instructions exactly, You are now in Edit View with the selected clip along with the timeline selection you selected in Multi-Track view, showing it's exact timeline location at the bottom which is relative to the Multi-Track view
IMPORTANT: YOU MUST BE CAREFUL NOT TO DE-SELECT THE TIMELINE SELECTION, AS THAT WILL DE-SELECT THE TIMELINE SELECTION IN BOTH VIEWS.
8) If you are having trouble looping without artifacts, To find the zero crossing points either go to edit > zero crossings or use shift+h or j for left edge, shift+K or L for right edge of the loop.
9) if you must adjust it manually to fine tune then make sure you shift click the file as not to de-select the entire timeline selection.
10) Once you have a perfect loop, zoom all the way in to the start and end points, and take note of exactly where the start and end points of the loop are located within the timeline.
11) Go back to Multi-track view
12 To trim the clips to to the exact timeline selection: Hold control+left_click each clip that needs adjusting one-time, then right click > group clips
13) BEING CAREFUL NOT TO DESELECT YOUR TIMELINE SELECTION, select your grouped clips by HOLDING CONTROL and clicking on any of the clips
14) Point to the start or end one of the clips, when you see the icon showing arrows going either way, right click and drag your clips to roughly match up with the timeline selection, then zoom in further and adjust the clip start and end points to match up exactly with the timeline selection start and endpoints.
WARNING: IF YOU ACCIDENTALLY CLICK WHEN THE DOUBLE ARROW ICON IS NOT SHOWING, YOU WILL DE-SELECT YOUR TIMELINE SELECTION AND YOU WILL HAVE TO START THIS ENTIRE PROCESS ALL OVER AGAIN.
15) Verify that your loop is looping correctly, in some tricky instances you may have to find different zero crossing points on the initial file you edited in edit view by repeating the above procedure, but this is unusual, although it just happened to me.
16) If everything went correctly, now all your clips on seperate tracks are looped in the exact same way, if you want to destructively edit each file down to it's loop size, you can keep your timeline selection and control+click a file then click "Edit" (the one in the toolbar of course), one by one destructively editing each file.
17) to extend the loop either set as a loop under "loop properties" and then just drag each file the number of times you want it to loop, or do it my way and right click the clip > duplicate and set the number of times to duplicate and whether to have them back to back or spaced, this is the quickest method for me.
Addendum: IF you have 2 files selected and click "Edit" to go to Edit view, it will give you the file of the clip you selected first, not 2nd. You must then go back to MT view, de-select the clip you selected first, then de-select the clip you want to edit, then RE-select the clip you want to edit.
-Also, you don't HAVE to group the files as I did in step 12, you can drag the edges of the clips to the timeline selection one by one, I just find it easier to group them after you have set the loop on one of the files in Edit View.
-Remember, you can't select the files one by one and have the timeline selection transfer to Edit View IF you group the files prior to going into Edit View.
GOT ALL THAT? I sure as hell don't know if I do ...
All this could be easily avoided if Audition would simply let you edit multiple files simultaneously in Edit View relative to their position on the Multi-Track timeline.
I'd also like to know why when you do a full zoom in, neither the selection or the clips will snap to the ruler points, only to just before and after the ruler points on the timeline.
And also (and this may be my fault) I don't understand why when the tempo of my session is 89.8bpm, the timeline under the tracks says "90bpm" why does it round it off..?
Isn't that inexact and couldn't that present problems with syncing loops? idk I could be wrong I can't get my head around these issues because of lack of knowledge on the subject, if someone could shed some light that would be great.correction needs to be made to step #14, I typed:
14) Point to the start or end one of the clips, when you see the icon showing arrows going either way, right click and drag your clips to roughly match up with the timeline selection, then zoom in further and adjust the clip start and end points to match up exactly with the timeline selection start and endpoints.
Here is the correction, THE CORRECTED PARTS ARE CAPITALIZED:
14) Point to the start or end OF one of the clips, when you see the icon showing arrows going either way, LEFT-CLICK and drag your clips to roughly match up with the timeline selection, then zoom in further and adjust the clip start and end points to match up exactly with the timeline selection's start and end points.
Another Correction:
Originally read:
Addendum: IF you have 2 files selected and click "Edit" to go to Edit view, it will give you the file of the clip you selected first, not 2nd. You must then go back to MT view, de-select the clip you selected first, then de-select the clip you want to edit, then RE-select the clip you want to edit.
Here is the the correction, CORRECTED PARTS ARE CAPITALIZED:
Addendum: IF you have 2 files selected and click "Edit" to go to Edit view, it will give you the file of the clip you selected first, not 2nd. IF YOU WANT TO EDIT THE 2ND FILE YOU SELECTED IN MULTI-TRACK VIEW, You must go back to Multi-track view, de-select the clip you selected first, then de-select the clip you want to edit, then RE-select the clip you want to edit, THEN CLICK "EDIT" TO GO TO EDIT VIEW. -
Need to loop through Recursive node
Hi Everyone,
I am having troubles looping through a node to get a boolean value called "Check".
Basically I am using the TreeNesteedInTable UI. One of the columns I display is the "Check" mentioned above. Basically the user can go through the tree structure and check his/her options. I should then be able to loop through this structure to get all the records "Checked". My application is not doing this.
At the moment I am looping through the top level node - think this is where my probelm is because this node can only be singleton! This means that I then have to loop through the Recusrsive node of this type to get the values as the recusrive is always non-singleton en must therefor contain the elements I am looking for. But, i do not know how tho get access to this node. Is this the correct way of doing it, or how should it be done otherwise?
Many thanks,
ChristiaanHI,
I got it to work like this:
public void addICAMForIncident( ) {
//@@begin addICAMForIncident()
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
try {
int count;
Bapi1240_Rc rootCause;
IPublicEhs_icam.IAbsentOrFailedControlsElement existingAbsentOrFailedControlsElement;
IPublicEhs_icam.IAbsentOrFailedControlsElement recursive;
IPublicEhs_icam.IAbsentOrFailedControlsElement recursiveChildElement;
IPublicEhs_icam.IAbsentOrFailedControlsNode recursiveChildNode;
// if(wdContext.nodeAbsentOrFailedControls() != null){
// set header data:
wdContext.currentHeader_CreateElement().setRecord_No(wdContext.currentHeader_GDElement().getRecord_No());
wdContext.currentHeader_CreateElement().setRecno_Root(wdContext.currentHeader_GDElement().getRecno_Root());
wdContext.currentHeader_CreateElement().setIncident(wdContext.currentGPInputNodeElement().getIPIncidentNum());
//Top Level Node (Singleton)
existingAbsentOrFailedControlsElement = wdContext.currentAbsentOrFailedControlsElement();
//We need to go through the values of the RECURSIVE node as that is where the values are!
//Each time we expand a node in the tree this recursive node is filled with values
for(int i = 0;i<existingAbsentOrFailedControlsElement.nodeRecursiveAbsentOrFailedControl().size();i++)
recursiveChildNode = existingAbsentOrFailedControlsElement.nodeRecursiveAbsentOrFailedControl().nodeRecursiveAbsentOrFailedControl(i);
for(int m = 0;m<recursiveChildNode.size();m++)
recursiveChildElement = recursiveChildNode.getAbsentOrFailedControlsElementAt(m);
if(recursiveChildElement.getCheck())
//New line in the "table":
rootCause = new Bapi1240_Rc();
rootCause.setFunction("009");
rootCause.setHierarchy_Key("EHS_IAL_STD");
rootCause.setNode_Key(recursiveChildElement.getNODE_ID());
rootCause.setRef_Recno(wdContext.currentHeader_GDElement().getRecord_No());
rootCause.setRef_Object("IAL");
rootCause.setRef_Recno_Smeas("0");
rootCause.setPrimarykey("00000000000000000001");
rootCause.setForeignkey("00000000000000000001");
rootCause.setFlgfrgnkey(true);
rootCause.setFlgprimkey(true);
rootCause.setFlag_Selected(true);
//add the line to the "table":
createInput.addRootcause(rootCause);
}//end if
}//end for
}// end for
// execute:
wdContext.currentBapi_Bus1240_Create_InputElement().modelObject().execute();
// invalidate the output structure:
wdContext.nodeOutput_Create().invalidate();
} catch (CMIException ex) {
msgMgr.reportException(ex.getLocalizedMessage(), true);
//@@end -
Hello everyone,
I have some troubles looping through a List using JSTL.
I have a List (itemList) of ItemConfiguration objects stored in session that i want to loop through. This is what i got so far:
<table width="200" border="0" cellpadding="0" cellspacing="0">
<jsp:useBean id="itemList" class="" scope="session" />
<c:forEach items="${itemList}" var="itemConfig">
<tr>
<td width="5"><img src="images/pixel.gif" width="1" height="2" /></td>
<td width="190"><img src="images/pixel.gif" width="1" height="2" /></td>
<td width="5"><img src="images/pixel.gif" width="1" height="2" /></td>
</tr>
<tr>
<td width="5"> </td>
<td width="190" align="center" class="menu"><c:out value="${itemConfig.name}" escapeXml="false"/></td>
<td width="5"> </td>
</tr>
</c:forEach>
</table>ItemConfiguration class have get/set methods (getName()/setName())
Can someone help me? im stuck at this and can�t make it work.
Thanks in advanceTry like this,
<logic:iterate id="myArray" property="itemConfig" Collection="<%=itemList%>">
<bean:write name="myArray" property="name" filter="false"/>"
</logic:iterate>
{code} -
Looping through OCIFetchStatement results
Hi, I'm having trouble looping through the results of OCIFetchStatement.
I have already connected to the database ok so I've excluded that code.
The code is as follows:
<?php
$sql = "SELECT dbname FROM live_rates_details";
$sql_statement = OCIParse($c, $sql) or die ("Couldn't parse statement.");
OCIExecute($sql_statement) or die ("Couldn't execute statement.");
// Fetch the results.
$numrows = OCIFetchStatement($sql_statement, $dbs);
// Print the number of rows
echo "$numrows<br>";
// Loop through the results
foreach ($dbs as $value)
echo "$value<br>";
?>
This code prints the number of rows correctly (22) but instead of looping through the array and printing results it just prints the word Array.
Any ideas?Saju,
That worked perfectly. However I now only have one row in my database and two columns as below:
Column names are fruit and colour and the data row is Bananna and Yellow.
My problem is that when selecting the code as you've put it it returns the following BanannaYellow.
How can I seperate these? If I only want to access the yellow part, how do I do that? $value[$i][1]
Any help would be appreciated. -
I just got DVD Studio Pro 4 after working with DVD Studio Pro 1 for years. I am having trouble looping video for continuous play. I set the beginning and end in the inspector window and set it on "loop". When that didn't work I added a chapter marker to the footage in FCP. Does anyone have any suggestions?
On your track in the property inspector set the end jump to be that track and it should loop for you. Hope this helps
sz -
Hai there. i am having a trouble with the garage band apple loops to get into my macbook pro. . i had it some time back and i dont know where it has gone and how it get it back. is there anyone to help me to get the loops back into the browser . i will be grateful to you if some one can help me with it/ thanks.
First check, if you do not accidentally have hidden or filtered your loops:
Uncheck the "Filter for more relevant results" option in the Audio tab of the GarageBand Preferences.
And the drop down menu on top of the Loop Browser should be set to "Loops", not to some Jam Pack or other collection.
If you still don't see any loops, check if you have set your project to a special signature, like 9/8, for that no standard loops do exist.
Then check, if any loops actually are installed in your system Library: Depending on your GarageBand version you should find the standard loops in the Audio folder of your system Library (Application Support > GarageBand):
Your System Drive > Library > Audio > Apple Loops
If the Loops are installed, but GarageBand does not show them, you need to rebuild your Apple Loops Index: See the FAQ for how to do it:
Re-Index GarageBand's Loops
This requires two steps:
erase the old Apple Loops Index by deleting everything in
Your System Drive > Library > Audio > Apple Loops Index
and then rebuilding the Loops Index by dragging the folder containing all of your loops onto the Loop Browser in GarageBand.
If no Loops are installed in your Library, you will have to restore them from your Backup.
Regards
Léonie -
Having trouble with garageband loops are out of time with other loops
having trouble with garageband have bought loops from primeloops and beat loops are not in time when i paste other loops down for example certain loops do not lock into measure region correctly .. so say for instance i lay down my beat then i try to add hi hat below and the beat is not in time with hi hat any awnsers may have pressed some setting accidently because this hasn t happened before as previously using these loops were all in time and locked at correct measures ..
The GarageBand experts await you here:
https://discussions.apple.com/community/ilife/garageband -
Trouble with DAQmxReadDigital Timeout (200284) when used in a threaded loop
Hi,
I'm using a NI6537 for fast Digital Acquisition. The board is installed on a NIPXIe-1062 crate controlled by a NI PXIe-8130 controller, where the software is running. I'm reading all the 32 lines as a single channel, at 50MS/s, and the clock is the one provided by the board itself. I put the timeout as infinite, but I also tried various other settings. As I'm reading a finite samples bunch of 524288 samples, at 50 MS/s, a timeout of 1 second should be by far sufficient.
As far as I put the DAQmxReadDigitalU32(...) call in a simple loop I have no troubles, everything working fine.
for (...) {
DAQmxReadDigitalU32(...);
} // That loop works perfectly
while, if a have a loop inside a multi-thread process, or simply I give the system some freedom inside the loop, sometimes I get the timeout error. Note that the time cost of the Sleep() function is just of some millisecond, so there is no reason for the call to timeout.
for (...) {
DAQmxReadDigitalU32(...);
Sleep(1); // To release system resources...
}// That loop stops erratically
With the last code, I can also see that actually the board did not complete the reading, i.e. is returning less samples than what requested. It seems to me that someting is stopping the acquisition, but I'm not able to figure what. The same happens even in LabView, using the VI read: sometimes the read randomly generates a timeout error and stops, even if LabView is the only running application.
Could you point me what I'm doing wrong?
Thanks, Piero.
DAQmxReadDigitalU32Duplicate Post
ColeR
Field Engineer -
I am having trouble with loops for my IT project
I am not shour if this is the correct place to post my question.I am sorry if this is the wrong place.
I have been given a school project to do in netbeans. Under the tab labeled "Timestable drill" I wrote code that is is supposted to output the timetable of a number requested by the user after they click on the view button.I tried to do this using a loop.
My problem is that the program only outputs the requested number multiplyed by 12 whilst it is supposed to out put something like this: for example the number requested by the user is 2
0*2=0
1*2=2
2*2=4
3*2=6
4*2=8
5*2=10
6*2=12
7*2=14
8*2=16
9*2=18
10*2=20
11*2=22
12*2=48
Is there something wrong with my code for the loop or should I use a diffrent component for the screen?
Any help would be useful. Thank you
this is my code
* calcBMI.java
* Created on 09 July 2008, 10:55
* @author Owner
public class calcBMI extends javax.swing.JFrame {
/** Creates new form calcBMI */
public calcBMI() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
Tabs = new javax.swing.JTabbedPane();
Standard_Calculator = new javax.swing.JPanel();
Calculatorlbl = new javax.swing.JLabel();
Screen = new javax.swing.JTextField();
btn7 = new javax.swing.JButton();
btn8 = new javax.swing.JButton();
btn9 = new javax.swing.JButton();
btn4 = new javax.swing.JButton();
btn5 = new javax.swing.JButton();
btn6 = new javax.swing.JButton();
btn1 = new javax.swing.JButton();
btn2 = new javax.swing.JButton();
btn3 = new javax.swing.JButton();
btn0 = new javax.swing.JButton();
btnpoint = new javax.swing.JButton();
btneq = new javax.swing.JButton();
btnplus = new javax.swing.JButton();
btnsubtract = new javax.swing.JButton();
btnmultiply = new javax.swing.JButton();
btndiv = new javax.swing.JButton();
btnclear = new javax.swing.JButton();
BMI_Calculator = new javax.swing.JPanel();
Scrn = new javax.swing.JTextField();
BMIlabel = new javax.swing.JLabel();
weight_btn = new javax.swing.JButton();
Height_btn = new javax.swing.JButton();
Clear = new javax.swing.JButton();
calcBtn = new javax.swing.JButton();
Tables_Drill = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
timetable = new javax.swing.JTextField();
Viewbttn = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
viewing_board = new javax.swing.JTextPane();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();
Quit = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu4 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu1 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
How_toBMI = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuBar2 = new javax.swing.JMenuBar();
jMenu6 = new javax.swing.JMenu();
Quit1 = new javax.swing.JMenuItem();
jMenu7 = new javax.swing.JMenu();
jMenu8 = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
jMenu9 = new javax.swing.JMenu();
jMenu10 = new javax.swing.JMenu();
jMenuItem5 = new javax.swing.JMenuItem();
How_toBMI1 = new javax.swing.JMenu();
jMenuItem6 = new javax.swing.JMenuItem();
jMenuBar3 = new javax.swing.JMenuBar();
jMenu11 = new javax.swing.JMenu();
Quit2 = new javax.swing.JMenuItem();
jMenu12 = new javax.swing.JMenu();
jMenu13 = new javax.swing.JMenu();
jMenuItem7 = new javax.swing.JMenuItem();
jMenu14 = new javax.swing.JMenu();
jMenu15 = new javax.swing.JMenu();
jMenuItem8 = new javax.swing.JMenuItem();
How_toBMI2 = new javax.swing.JMenu();
jMenuItem9 = new javax.swing.JMenuItem();
jMenuBar4 = new javax.swing.JMenuBar();
jMenu16 = new javax.swing.JMenu();
Quit3 = new javax.swing.JMenuItem();
jMenu17 = new javax.swing.JMenu();
jMenu18 = new javax.swing.JMenu();
jMenuItem10 = new javax.swing.JMenuItem();
jMenu19 = new javax.swing.JMenu();
jMenu20 = new javax.swing.JMenu();
jMenuItem11 = new javax.swing.JMenuItem();
How_toBMI3 = new javax.swing.JMenu();
jMenuItem12 = new javax.swing.JMenuItem();
jMenuBar5 = new javax.swing.JMenuBar();
jMenu21 = new javax.swing.JMenu();
Quit4 = new javax.swing.JMenuItem();
jMenu22 = new javax.swing.JMenu();
jMenu23 = new javax.swing.JMenu();
jMenuItem13 = new javax.swing.JMenuItem();
jMenu24 = new javax.swing.JMenu();
jMenu25 = new javax.swing.JMenu();
jMenuItem14 = new javax.swing.JMenuItem();
How_toBMI4 = new javax.swing.JMenu();
jMenuItem15 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
Calculatorlbl.setBackground(new java.awt.Color(0, 204, 255));
Calculatorlbl.setFont(new java.awt.Font("Heather", 1, 18));
Calculatorlbl.setForeground(new java.awt.Color(0, 204, 204));
Calculatorlbl.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
Calculatorlbl.setText("CALCULATOR");
btn7.setBackground(new java.awt.Color(204, 204, 204));
btn7.setForeground(java.awt.Color.magenta);
btn7.setText("7");
btn7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn7ActionPerformed(evt);
btn8.setBackground(new java.awt.Color(204, 204, 204));
btn8.setForeground(java.awt.Color.magenta);
btn8.setText("8");
btn8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn8ActionPerformed(evt);
btn9.setBackground(new java.awt.Color(204, 204, 204));
btn9.setForeground(java.awt.Color.magenta);
btn9.setText("9");
btn9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn9ActionPerformed(evt);
btn4.setBackground(new java.awt.Color(204, 204, 204));
btn4.setForeground(java.awt.Color.magenta);
btn4.setText("4");
btn4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn4ActionPerformed(evt);
btn5.setBackground(new java.awt.Color(204, 204, 204));
btn5.setForeground(java.awt.Color.magenta);
btn5.setText("5");
btn5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn5ActionPerformed(evt);
btn6.setBackground(new java.awt.Color(204, 204, 204));
btn6.setForeground(java.awt.Color.magenta);
btn6.setText("6");
btn6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn6ActionPerformed(evt);
btn1.setBackground(new java.awt.Color(204, 204, 204));
btn1.setForeground(java.awt.Color.magenta);
btn1.setText("1");
btn1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn1ActionPerformed(evt);
btn2.setBackground(new java.awt.Color(204, 204, 204));
btn2.setForeground(java.awt.Color.magenta);
btn2.setText("2");
btn2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
btn3.setBackground(new java.awt.Color(204, 204, 204));
btn3.setForeground(java.awt.Color.magenta);
btn3.setText("3");
btn3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
btn0.setBackground(new java.awt.Color(204, 204, 204));
btn0.setForeground(java.awt.Color.magenta);
btn0.setText("0");
btn0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn0ActionPerformed(evt);
btnpoint.setBackground(new java.awt.Color(204, 204, 204));
btnpoint.setForeground(java.awt.Color.magenta);
btnpoint.setText(".");
btnpoint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnpointActionPerformed(evt);
btneq.setBackground(new java.awt.Color(204, 204, 204));
btneq.setForeground(java.awt.Color.magenta);
btneq.setText("=");
btneq.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btneqActionPerformed(evt);
btnplus.setText("+");
btnplus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnplusActionPerformed(evt);
btnsubtract.setText("-");
btnsubtract.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnsubtractActionPerformed(evt);
btnmultiply.setText("*");
btnmultiply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnmultiplyActionPerformed(evt);
btndiv.setText("/");
btndiv.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btndivActionPerformed(evt);
btnclear.setText("C");
btnclear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnclearActionPerformed(evt);
javax.swing.GroupLayout Standard_CalculatorLayout = new javax.swing.GroupLayout(Standard_Calculator);
Standard_Calculator.setLayout(Standard_CalculatorLayout);
Standard_CalculatorLayout.setHorizontalGroup(
Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(Calculatorlbl, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addComponent(btn7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn9))
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addComponent(btn4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn6))
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addComponent(btn1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn3))
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addComponent(btn0)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnpoint)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btneq)))
.addGap(60, 60, 60)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnmultiply)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnclear)
.addComponent(btndiv))
.addComponent(btnsubtract)
.addComponent(btnplus)))
.addComponent(Screen, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(38, Short.MAX_VALUE))
Standard_CalculatorLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnclear, btndiv, btnmultiply, btnplus, btnsubtract});
Standard_CalculatorLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn0, btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btneq, btnpoint});
Standard_CalculatorLayout.setVerticalGroup(
Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addContainerGap()
.addComponent(Calculatorlbl, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(Screen, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 4, Short.MAX_VALUE)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn8)
.addComponent(btn7)
.addComponent(btn9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn4)
.addComponent(btn5)
.addComponent(btn6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn1)
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(Standard_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn0)
.addComponent(btnpoint)
.addComponent(btneq))
.addGap(25, 25, 25))
.addGroup(Standard_CalculatorLayout.createSequentialGroup()
.addComponent(btnplus, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnsubtract)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnmultiply, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btndiv)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnclear)))
.addGap(37, 37, 37))
Tabs.addTab("Standard Calculator", Standard_Calculator);
BMIlabel.setFont(new java.awt.Font("Heather", 1, 18));
BMIlabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
BMIlabel.setText("BMI Calculator");
weight_btn.setText("Weight (Kg)");
weight_btn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
weight_btnActionPerformed(evt);
Height_btn.setText("Height (m)");
Height_btn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Height_btnActionPerformed(evt);
Clear.setText("Clear");
Clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ClearActionPerformed(evt);
calcBtn.setText("Calculate");
calcBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
calcBtnActionPerformed(evt);
javax.swing.GroupLayout BMI_CalculatorLayout = new javax.swing.GroupLayout(BMI_Calculator);
BMI_Calculator.setLayout(BMI_CalculatorLayout);
BMI_CalculatorLayout.setHorizontalGroup(
BMI_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(BMI_CalculatorLayout.createSequentialGroup()
.addGroup(BMI_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(BMI_CalculatorLayout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(BMI_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(weight_btn)
.addComponent(Height_btn))
.addGap(66, 66, 66)
.addGroup(BMI_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(calcBtn)
.addComponent(Clear)))
.addGroup(BMI_CalculatorLayout.createSequentialGroup()
.addContainerGap()
.addComponent(Scrn, javax.swing.GroupLayout.PREFERRED_SIZE, 301, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(BMI_CalculatorLayout.createSequentialGroup()
.addGap(29, 29, 29)
.addComponent(BMIlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(35, Short.MAX_VALUE))
BMI_CalculatorLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {Clear, Height_btn, calcBtn, weight_btn});
BMI_CalculatorLayout.setVerticalGroup(
BMI_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(BMI_CalculatorLayout.createSequentialGroup()
.addContainerGap()
.addComponent(BMIlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(9, 9, 9)
.addComponent(Scrn, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34)
.addGroup(BMI_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(weight_btn)
.addComponent(calcBtn))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(BMI_CalculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Height_btn)
.addComponent(Clear))
.addContainerGap(100, Short.MAX_VALUE))
Tabs.addTab("BMI Calculator", BMI_Calculator);
jLabel1.setText("Tables drill");
jLabel2.setText("Timetable ");
Viewbttn.setText("VIEW");
Viewbttn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ViewbttnActionPerformed(evt);
jScrollPane2.setViewportView(viewing_board);
javax.swing.GroupLayout Tables_DrillLayout = new javax.swing.GroupLayout(Tables_Drill);
Tables_Drill.setLayout(Tables_DrillLayout);
Tables_DrillLayout.setHorizontalGroup(
Tables_DrillLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Tables_DrillLayout.createSequentialGroup()
.addGroup(Tables_DrillLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Tables_DrillLayout.createSequentialGroup()
.addContainerGap()
.addGroup(Tables_DrillLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
.addGroup(Tables_DrillLayout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41)
.addGroup(Tables_DrillLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(timetable, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Viewbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(152, 152, 152))))
.addGroup(Tables_DrillLayout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
Tables_DrillLayout.setVerticalGroup(
Tables_DrillLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Tables_DrillLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(Tables_DrillLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(timetable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Viewbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(40, 40, 40)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(41, Short.MAX_VALUE))
Tabs.addTab("Tables Drill", Tables_Drill);
jMenu2.setText("File");
Quit.setText("Exit");
Quit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
QuitActionPerformed(evt);
jMenu2.add(Quit);
jMenuBar1.add(jMenu2);
jMenu3.setText("Edit");
jMenu4.setText("Clear");
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
jMenuItem1.setText("Screen");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
jMenu4.add(jMenuItem1);
jMenu3.add(jMenu4);
jMenuBar1.add(jMenu3);
jMenu1.setText("Help");
jMenu5.setText("Standard Calculator");
jMenuItem2.setText("Item");
jMenu5.add(jMenuItem2);
jMenu1.add(jMenu5);
How_toBMI.setText("BMI Calculator");
How_toBMI.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
How_toBMIActionPerformed(evt);
jMenuItem3.setText("How to use");
How_toBMI.add(jMenuItem3);
jMenu1.add(How_toBMI);
jMenuBar1.add(jMenu1);
jMenu6.setText("File");
Quit1.setText("Exit");
Quit1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
QuitActionPerformed(evt);
jMenu6.add(Quit1);
jMenuBar2.add(jMenu6);
jMenu7.setText("Edit");
jMenu8.setText("Clear");
jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
jMenuItem4.setText("Screen");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
jMenu8.add(jMenuItem4);
jMenu7.add(jMenu8);
jMenuBar2.add(jMenu7);
jMenu9.setText("Help");
jMenu10.setText("Standard Calculator");
jMenuItem5.setText("Item");
jMenu10.add(jMenuItem5);
jMenu9.add(jMenu10);
How_toBMI1.setText("BMI Calculator");
How_toBMI1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
How_toBMIActionPerformed(evt);
jMenuItem6.setText("How to use");
How_toBMI1.add(jMenuItem6);
jMenu9.add(How_toBMI1);
jMenuBar2.add(jMenu9);
jMenu11.setText("File") &nbsI love when new people think they have to show their entire application when they only have a problem with a little piece.
If you have a problem with a loop, just post the loop! Why should we need to sift through all your GUI code and other irrelevant nonsense? It's your job to show us the information we need to help you. -
Trouble starting ipod (very low battery message) and loop
Hello. I am having troble to start my ipod classic 5 generation. The message "please wait very low battery" (with an ipod with sad face) appears but the weird thing is that i just used it yesterday and i left it fully charged...but well. Then i try to charge the battery with a wall charger but it starts on a loop passing from the black screen with the apple logo, then it goes to the message "go to itunes/ipod/support" web site. and then it says again "please wait very low battery" just for a second and then it goes back to the black screen with apple logo and does this again and again. Then i tried to connect my ipod to the computer, after i do this it shows the message "please wait very low battery" and stays like this forever. I have tried ALL the suggestions, from trying to restart the ipod by clicking the middle button and the menu button at the same time (several times) and then clicking the middle button and the play button so it gows to the disk ode and nothing. I tryed witting it on the right corner and nothing. I already tested 3 usb different cables and nothing. It is not my usb port (i made tests with an ipod touch i have and works fine). Daaaaaaaaaarn!!! I really dont know waht to do now.
Any advises please!!!!?
Thanks a lot!
RickHave you seen these articles?
iPod displays a folder icon with an exclamation point
iPod displays a sad iPod icon
Also, here's s very good post about the sad iPod icon and/or exclamation point and folder:
Mitch: Exclamation point and folder and nothing else!
-Kylene -
Having trouble with inner for loop values in my procedure
Hi ...
I am using oracle 10g and here is my procedure ...
create or replace procedure sales_information is
v_qty number(10);
rem_qty number(10):=0;
cursor pck_quantity is
select * from sales_info;
cursor no_of_labels is
select ceil(sum(nvl(total_quantity,actual_quantity))/400) from sales_info;
begin
for j in no_of_labels
loop
for i in pck_quantity
loop
select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
if v_qty>=i.packed_quantity and rem_qty=0 then
insert into sales_order values------------
rem-qty:=v_qty-i.packed_quantity;
v_qty:=rem_qty;
exit;
else if v_qty>=i.packed_quantity and rem_qty>=400 then
insert into sales_order values-----------
rem_qty:=v_qty-rem_qty;
v_qty:=rem_qty;
exit;
else if v_qty>=i.packed_quantity and rem_qty>0 then
rem_qty:=v_qty+rem_qty-i.packed_quantity;
v_qty:=rem_qty;
insert into sales_order values-----------
else if v_qty is null and rem_qty>0 and then
insert into sales_order values-----------
else if v_qty<i.packed_quantity and rem_qty:=0 then
rem_qty:=v_qty;
else if v_qty<i.packed_quantity and rem_qty>0 then
if (v_qty+rem_qty)>400 then
insert into sales_order values-----------
rem_qty:=v_qty+rem_qty-i.packed_quantity;
v_qty:=rem_qty;
end if;
end if;
end loop;
end loop;
The inner for loop will retrieve the same values of v_qty for every iteration of outer for loop when it runs the following select statement:
select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
and thus loses the previously computed values of v_qty and rem_qty
in the previous iteration of outer for loop whereas i want the inner for loop to iterate over it's previously computed values of v_qty and rem_qty but cant think of a workaround.h4. Thanks Dave for explanation. Hope I understood your requirement and below code resolves that
-- Creating table SALES_INFO
CREATE TABLE SALES_INFO
( S_NO NUMBER(1),
ACTUAL_QUANTITY NUMBER(10),
TOTAL_QUANTITY NUMBER(10),
PACKED_QUANTITY NUMBER(10)
-- Creating table sales_order
CREATE TABLE SALES_ORDER
( S_NO NUMBER(1),
LABEL VARCHAR2(30),
ORDER_QUANTITY NUMBER(10)
-- Push SALES_INFO data
INSERT INTO SALES_INFO VALUES(1,1000,800,400);
INSERT INTO SALES_INFO VALUES(2,800,600,400);
INSERT INTO SALES_INFO VALUES(3,800,NULL,400);
INSERT INTO SALES_INFO VALUES(4,NULL,600,400);
CREATE OR REPLACE PROCEDURE populate_sales_order AS
CURSOR get_sales_info IS
SELECT s_no,
NVL(total_quantity,actual_quantity) total_quantity,
packed_quantity
FROM sales_info;
v_s_no PLS_INTEGER := 0;
v_rem_qty PLS_INTEGER := 0;
v_label_num PLS_INTEGER := 1;
BEGIN
FOR rec IN get_sales_info LOOP
v_rem_qty := rec.total_quantity + v_rem_qty;
v_s_no := rec.s_no;
WHILE v_rem_qty >= rec.packed_quantity LOOP
INSERT INTO sales_order( s_no, label, order_quantity)
VALUES ( v_s_no, 'LABEL' || v_label_num, rec.packed_quantity );
-- Reduce the packed qty from total qty and increment label counter
v_rem_qty := v_rem_qty - rec.packed_quantity ;
v_label_num := v_label_num + 1;
END LOOP;
END LOOP;
-- Put the last lot remaining qty into last carton
IF v_rem_qty > 0 THEN
INSERT INTO sales_order( s_no, label, order_quantity)
VALUES (v_s_no, 'LABEL' || v_label_num, v_rem_qty );
END IF;
COMMIT;
END;
S_NO LABEL ORDER_QUANTITY
1 LABEL1 400
1 LABEL2 400
2 LABEL3 400
3 LABEL4 400
3 LABEL5 400
4 LABEL6 400
4 LABEL7 400
{code}
Maybe you are looking for
-
Instalation SAP NetWeaver ABAP Trail Version
Hello i am new user from SAP. i tried firstly to install the miniSap system. i do the Folowing step: 1- under : home\..\SAP\SAPNWABAP701SR1_TRIAL\SAP_NetWeaver701SR1_2008_Installation_Master\IM_WINDOWS_I386\sapinst.exe 2- i choose central system and
-
Shortcuts do not work anymore in Safari and Maps since I updated to Yosemite
Since I upgraded to Yosemite, both Safari 8.0 and Maps 2.0 do not respond to any shortcuts, like "cmd q" to quit or "cmd c" to copy. I have to do everything manually which is quite frustrating, as it slows my workflow down. I can only use the shortcu
-
Default protocol handlers in Openbox
Hi all! I'm switching from KDE to my own openbox-based environment. I really love the idea of building a system that just suits my needs. Nevertheless, I have stepped into some minor issues while trying to configure it (all told, less than I expected
-
Hi there, I've been having problems with ff crashing with flash sites and then I have noticed that Flash isn't installing properally since it goes to load the setup and gets to 100% and disappears of the task bar. Checked the processes and it's still
-
Cannot open Landscape configurator
Hi When I am trying to open the Lanscape Configurator with this URL http://hostname:port no/webdynpro/dispatcher/sap.com/tcSLCMS~WebUI/Cms it is giving error message 500 Internal Server Error SAP J2EE Engine/7.00 Application error occurred dur