Help with Spark ComboBox with Variable width dropdown list
I have a Flex 4.0 app which uses a lot of Comboboxes. These combo boxes can contain relatively large items in relation to the actual combobox size.
I want the dropdown list width to expand to a size which will fit all the items it has to display - but only when the dropdown list is opened.
I know there was a way of doing this with the mx components however cannot find any information on this for Spark components.
Does anybody have a solution for this?
thanks in advance
Create a skin for your combobox copying the original one and set popUpWidthMatchesAnchorWidth in the PopUpAnchor to false
Similar Messages
-
Hi ,
I have some problem at the variable screen. When I click the possible entries for 0calmonth in the query selection screen and I could not able to see the possible entries. The screen comes blank. When I check for 0calday and ocalweek i get the possible entries.
I have checked the data inside the infoprovider and the data is available in it. I have tried activating the 0calmonth again. I have tried all the possible options. Please help as it is very urgent.
Regards
RaghuHi,
Probably for the selections given while entering the query, the 0calmonth might not have been present.
Check in the infoprovider with the same selection parameters you are initialling giving while running the query and c whether the calmonth is there or not?
Also once check infoprovder whether the 0calmonth is updating r not
***assign points if helpful******
Janardhan KUmar -
How do I input column headers in an Excel report with variable width columns?
Hi:
I have read this question before but I can´t open the link, when I try to download the solution I get the following : HTTP Status 404 The requested resource is not available.
Can anyone help me with the solution ? I just want to put a header for each column (thermocouple 1, thermocouple 2, anemometer , etc).
In advance, thanks for all your help !
Solved!
Go to Solution.Perhaps you need to take some tutorials.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
Attachments:
Example_VI_BD.png 11 KB -
Custom brush with variable width
I am a beginner at Illustrator, so I'm not sure if this is possible. Is there any way to have a brush "repeat" itself over the width of a line, depending on the stroke weight, instead of just getting thicker?
As a simple example, imagine a custom brush that will behave as follows:
If applied to a line of, say, stroke weight = 4pt, this brush would make the line look like two parallel lines. Then, if the weight of the line was increased to 8pt, it would look like the 4 parallel lines. The default behavior seems to be that the original TWO parallel lines just get thicker, as the stroke weight is increased. I am looking for a way to make the pattern repeat not ALONG the line, but parallel to the line as its thickness is increased.
Sorry if that wasn't well described.Not as you describe. What you would have to do is use the appearance and keep adding new strokes with an offset effect as welll but if it is an open path the new strokes offset wrap around the ends as if the orignal stroke was contained within a closed path.
the best way for open paths are a brush for each stroke width yoou need and save it as a library of such brushes.
Also visit the Illustrator Feature request form and feature request and make the request.
I think you have something good to offer. -
I need help with Variable Manipulation
I've been searching on google for over an hour and a half to find Variable manipulation. It seems either you know how to do it or you don't. I'm trying to do 3 things:
I want a text box in which I enter text and it manipulates a variable so that when I press enter, the variable becomes that text.
I want to be able to at the click of a button either assign a variable or add to that variable, whether it be incrementing or adding larger numbers.
Finally, I want to be able to reveal those variable either at the click of a button or when the frame of the scene I'm making starts.
Could someone please explain to me either how to do it or where to look so I can teach myself?Ok...after creating what you are looking for I think your confusion may be in global variables initialization with Director vs other languages. Within Director it is necessary to reintialize the global variable within each script you need to access it in.
So what I have done is create a two slide movie...for lack of better names slide 1 and slide 2.
Step 1: create the PrepareMovie Script - this script preloads the field (text box) with "type your name". In this case I just assigned "type your name" to the playerName global varialble.
On prepareMovie
global playerName
playerName="type your name"
member("fName").text=playerName
end
Step 2:
Place cast members into slide 1
your name - text cast member
fname - field cast member
continue - sprite button
Step 3:
Place cast members into slide 2
verify - text cast member
recall - sprite button
reveal - text cast member
Result should look something like this in the score:
Step 4: Scripts
Script 6 is nothing more than a "go to the frame" script to keep the play head in place.
on exitFrame me
go to the frame
end
Script 7 just under the Slider 2 Marker
on prepareframe me
global playerName
member("verify").text="Just to be certain your name is " & playerName
end
The Continue Button Script - attach this to the button as button script
on mouseUp
global playerName
---stuff within the field box
playerName=member("fname").text
go to next
end
The Reveal Button Script
on mouseUp me
global playerName
member("revealname").text=playerName
end
Thats it really....if its your first time using global variables inside director it can be a bit confusing if you are used to other programming languages.
Good luck -
Hi Guys,
I was hoping you could help me. This is my page width in dreamweaver.
And now here's my site in Firefox.
Does anyone know how to fix this?
Many thanksPage width should be defined in your CSS code. Below are some examples of centered, fixed-width CSS Layouts.
View source in browser to see the code.
Basic 1-col layout
http://alt-web.com/TEMPLATES/Basic-1-col-fixed.shtml
Basic 2-col layout
http://alt-web.com/TEMPLATES/2-col-fixed-layout.shtml
Basic 3-col layout
http://alt-web.com/TEMPLATES/3-col-970.shtml
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb -
Help with Services from dropdown
Hi everyone,
Everytime I try to use "services" - from the Safari toolbar (Click Safari, then Services from dropdown) I get many of my applications.
The one I would frequently like to use is "Grab" but it's never highlighted as working.
THe word Grab is dark - but then "Screen" "Selection" and "Timed Selection" are grayed out and I cannot grab a page.
I know of the other ways to get grab - but I want to use this pulldown. Why have it if it never works...
I'm sure I'm the one doing something wrong so if someone can help me I would really be appreciative.
Have a beautiful day!
Claudia
<edited out by Moderator>Hi Claudia, You're not doing anything wrong. The Services menu for Grab doesn't work on Tiger either. It's a bug.
You have a beautiful day too!
Tom -
I am trying to make a single mp3 player to stream various mp3
files on a website.
I can get it to work if i state the mp3 file in the action
script but i want to state the mp3 file in the param code of the
HTML page
This is the code i am using to load my mp3
s = new Sound();
s.loadSound("test.mp3",true);
gotoAndPlay("Playing");
i have no idea how to get it to load an mp3 using the param
tags
can anyone help
the following is a link to the files in a zip file.
MP3PLAYER
Any help would really be appreciated i have been trying
different things for about a month and have had no luck and cant
find any help on the web, they all seem to want to use XML to load
many mp3 filesI'd suggest using SWFObject to embed your movie - aside from
the other
benefits, it makes passing query variables into your movie
super easy.
<script type="text/javascript">
var so = new SWFObject("myplayer.swf", "myplayer", "400",
"200", "8",
"#336699");
so.addVariable("themp3", getQueryParamValue("mp3"));
so.write("flashcontent");
</script>You're getting the mp3 variable from the URL
and assigning it to
the 'themp3' var in Flash. So, your URL might look like:
http://www.mydomain.com/player.htm?mp3=somesong.mp3
Then in Flash, you'd just use themp3:
s = new Sound();
s.loadSound(themp3, true);
gotoAndPlay("Playing");
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
[Help]Need help with variables php,Sql
I have a table users contain fiedls "old,new & total"
when submit , update users SET total = $total
where $total = $old+$new
I did this , I used echo to make sure it is ok , but it is not :
/* Variable to Count Total */
$old=$row_rs_users['old'];
$new=$row_rs_users['new'];
$total=$old+ $new;
echo $total;
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "doit_form")) {
$updateSQL = sprintf("UPDATE users SET total=%s WHERE id=%s",
$total,
GetSQLValueString($_POST['id'], "int"));
Thanks,Seeing only part of your code, it's impossible to debug.
However, your approach is wrong anyway. All you need to do is to add the new value to the old one in the SQL query.
$updateSQL = sprintf("UPDATE users SET total=(total+%s) WHERE id=%s",
GetSQLValueString($_POST['fieldName'], "double"),
GetSQLValueString($_POST['id'], "int"));
$_POST['fieldName'] is the new value being added. Use "double" if the value contains a decimal point. If it's an integer, change "double" to "int". -
I need help with variables (probably an easy fix).
These two programs are supposed to run together. Class "TheCracker" is supposed to guess the password of Class "ThePassword" until it gets it right.
public class TheCracker {
public static void main(String args[]) {
ThePassword password = new ThePassword();
int passwordentered;
int realpassword;
realpassword = password.realpassword;
do {
for (passwordentered = 0; passwordentered!=realpassword;passworden... {
System.out.print(passwordentered);
while (passwordentered != realpassword);
public class ThePassword {
public static void main(String args[]) {
TheCracker cracker = new TheCracker();
int passwordentered;
int realpassword;
realpassword = 45;
do {
System.out.print("What is the password?");
passwordentered = cracker.passwordentered;
if (passwordentered == realpassword) {
System.out.print("The password is correct");
else {
System.out.print("The password is incorrect");
} while (passwordentered != realpassword);
The error that occurs is that it cannot find symbol variable realpassword in the Class "TheCracker" and it cannot find symbol variable "passwordentered" in the Class "ThePassword"
Here are the two lines of code that the error occurs in:
realpassword = password.realpassword;
and
passwordentered = cracker.passwordentered;When you post code, use the CODE button or [code] and [/code] tags to preserve formatting and make your code readable. Copy/paste from your original source in your editor, NOT from your first post here, which has already lost all formatting.
-
Can someone help with splitting a Linked List.??
Any help would be awesome!!!
My code just will not work!! Any help would be appreciated! My problem is in the last method SplitAt. These are the conditions set and my code:
Splitting a Linked List at a Given Node, into Two Sublists
a. Add the following as an abstract method to the class
LinkedListClass:
public void splitAt (LinkedListClass<T> secondList, T item);
//This method splits the list at the node with the info item into two sublists.
//Precondition: The list must exist.
//Postcondition: first and last point to the first and last nodes of the first sublist,
// respectively. secondList.first and secondList.last point to the first
// and last nodes of the second sublist.
Consider the following statements:
UnorderedLinkedList<Integer> myList;
UnorderedLinkedList<Integer> otherList;
Suppose myList points to the list with the elements 34, 65, 18, 39, 27, 89, and 12 (in this order). The statement
myList.splitAt(otherList, 18);
splits myList into two sublists: myList points to the list with elements 34 and 65, and otherList points to the sublist with elements 18, 39, 27, 89, and 12.
b. Provide the definition of the method splitAt in the class UnorderedLinkedList. Also write a program to test your method.
public class UnorderedLinkedList<T> extends LinkedListClass<T>
//Default constructor
public UnorderedLinkedList()
super();
//Method to determine whether searchItem is in
//the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public boolean search(T searchItem)
LinkedListNode<T> current; //variable to traverse
//the list
boolean found;
current = first; //set current to point to the first
//node in the list
found = false; //set found to false
while (current != null && !found) //search the list
if (current.info.equals(searchItem)) //item is found
found = true;
else
current = current.link; //make current point to
//the next node
return found;
//Method to insert newItem in the list.
//Postcondition: first points to the new list
// and newItem is inserted at the
// beginning of the list. Also,
// last points to the last node and
// count is incremented by 1.
public void insertFirst(T newItem)
LinkedListNode<T> newNode; //variable to create the
//new node
newNode =
new LinkedListNode<T>(newItem, first); //create and
//insert newNode before
//first
first = newNode; //make first point to the
//actual first node
if (last == null) //if the list was empty, newNode is
//also the last node in the list
last = newNode;
count++; //increment count
//Method to insert newItem at the end of the list.
//Postcondition: first points to the new list and
// newItem is inserted at the end
// of the list. Also, last points to
// the last node and
// count is incremented by 1.
public void insertLast(T newItem)
LinkedListNode newNode; //variable to create the
//new node
newNode =
new LinkedListNode(newItem, null); //create newNode
if (first == null) //if the list is empty, newNode is
//both the first and last node
first = newNode;
last = newNode;
else //if the list is not empty, insert
//newNode after last
last.link = newNode; //insert newNode after last
last = newNode; //set last to point to the
//actual last node
count++;
}//end insertLast
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list. Also, first points to the first
// node, last points to the last
// node of the updated list, and count
// is decremented by 1.
public void deleteNode(T deleteItem)
LinkedListNode<T> current; //variable to traverse
//the list
LinkedListNode<T> trailCurrent; //variable just
//before current
boolean found;
if ( first == null) //Case 1; the list is empty
System.err.println("Cannot delete from an empty "
+ "list.");
else
if (first.info.equals(deleteItem)) //Case 2
first = first.link;
if (first == null) //the list had only one node
last = null;
count--;
else //search the list for the given info
found = false;
trailCurrent = first; //set trailCurrent to
//point to the first node
current = first.link; //set current to point to
//the second node
while (current != null && !found)
if (current.info.equals(deleteItem))
found = true;
else
trailCurrent = current;
current = current.link;
}//end while
if (found) //Case 3; if found, delete the node
count--;
trailCurrent.link = current.link;
if (last == current) //node to be deleted
//was the last node
last = trailCurrent; //update the value
//of last
else
System.out.println("Item to be deleted is "
+ "not in the list.");
}//end else
}//end else
}//end deleteNode
public void splitAt(LinkedListClass<T> secondList, T item)
LinkedListNode<T> current;
LinkedListNode<T> trailCurrent;
int i;
boolean found;
if (first==null)
System.out.println("Empty.");
first=null;
last=null;
count--;
else
current=first;
found=false;
i=1;
while(current !=null &&!found)
if(current.info.equals(secondList))
found= true;
else
trailCurrent=current;
i++;
if(found)
if(first==current)
first=first;
last=last;
count=count;
count=0;
else
first=current;
last=last;
last=null;
count = count- i+1;
count = i-1;
else
System.out.println("Item to be split at is "
+ "not in the list.");
first=null;
last=null;
count=0;
}Edited by: romeAbides on Oct 10, 2008 1:24 PMI dont have a test program at all. The program is supposed to prompt for user input of numbers. (it does) Take the input and end at input of -999 (it does). Then it asks user where it wants to split list (it does). When I enter a number it does nothing after that. I am going to post updated code and see if that helps along with all the classes. Thanks!
This is the class to prompt:
import java.util.*;
public class Ch16_ProgEx6
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
UnorderedLinkedList<Integer> list
= new UnorderedLinkedList<Integer>();
UnorderedLinkedList<Integer> subList =
new UnorderedLinkedList<Integer>();
Integer num;
System.out.println("Enter integers ending with -999.");
num = console.nextInt();
while (num != -999)
list.insertLast(num);
num = console.nextInt();
System.out.println();
System.out.println("list: ");
list.print();
System.out.println();
System.out.println("Length of list: " + list.length());
System.out.print("Enter the number at which to split list: ");
num = console.nextInt();
list.splitAt(subList, num);
System.out.println("Lists after splitting list");
System.out.print("list: ");
list.print();
System.out.println();
System.out.println("Length of list: " + list.length());
System.out.print("sublist: ");
subList.print();
System.out.println();
System.out.println("Length of sublist: " + subList.length());
}This is the ADT:
public interface LinkedListADT<T> extends Cloneable
public Object clone();
//Returns a copy of objects data in store.
//This method clones only the references stored in
//each node of the list. The objects that the
//list nodes point to are not cloned.
public boolean isEmptyList();
//Method to determine whether the list is empty.
//Postcondition: Returns true if the list is empty;
// false otherwise.
public void initializeList();
//Method to initialize the list to an empty state.
//Postcondition: The list is initialized to an empty
// state.
public void print();
//Method to output the data contained in each node.
public int length();
//Method to return the number of nodes in the list.
//Postcondition: The number of nodes in the list is
// returned.
public T front();
//Method to return a reference of the object containing
//the data of the first node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the first node
// is returned.
public T back();
//Method to return a reference of object containing
//the data of the last node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the last node
// is returned.
public boolean search(T searchItem);
//Method to determine whether searchItem is in the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public void insertFirst(T newItem);
//Method to insert newItem in the list.
//Postcondition: newItem is inserted at the
// beginning of the list.
public void insertLast(T newItem);
//Method to insert newItem at the end of the list.
//Postcondition: newItem is inserted at the end
// of the list.
public void deleteNode(T deleteItem);
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list.
public void splitAt(LinkedListClass<T> secondList, T item);
}This is the linked list class:
import java.util.NoSuchElementException;
public abstract class LinkedListClass<T> implements LinkedListADT<T>
protected class LinkedListNode<T> implements Cloneable
public T info;
public LinkedListNode<T> link;
//Default constructor
//Postcondition: info = null; link = null;
public LinkedListNode()
info = null;
link = null;
//Constructor with parameters
//This method sets info pointing to the object to
//which elem points to and link is set to point to
//the object to which ptr points to.
//Postcondition: info = elem; link = ptr;
public LinkedListNode(T elem, LinkedListNode<T> ptr)
info = elem;
link = ptr;
//Returns a copy of objects data in store.
//This method clones only the references stored in
//the node. The objects that the nodes point to
//are not cloned.
public Object clone()
LinkedListNode<T> copy = null;
try
copy = (LinkedListNode<T>) super.clone();
catch (CloneNotSupportedException e)
return null;
return copy;
//Method to return the info as a string.
//Postcondition: info as a String object is
// returned.
public String toString()
return info.toString();
} //end class LinkedListNode
public class LinkedListIterator<T>
protected LinkedListNode<T> current; //variable to
//point to the
//current node in
//list
protected LinkedListNode<T> previous; //variable to
//point to the
//node before the
//current node
//Default constructor
//Sets current to point to the first node in the
//list and sets previous to null.
//Postcondition: current = first; previous = null;
public LinkedListIterator()
current = (LinkedListNode<T>) first;
previous = null;
//Method to reset the iterator to the first node
//in the list.
//Postcondition: current = first; previous = null;
public void reset()
current = (LinkedListNode<T>) first;
previous = null;
//Method to return a reference of the info of the
//current node in the list and to advance iterator
//to the next node.
//Postcondition: previous = current;
// current = current.link;
// A refrence of the current node
// is returned.
public T next()
if (!hasNext())
throw new NoSuchElementException();
LinkedListNode<T> temp = current;
previous = current;
current = current.link;
return temp.info;
//Method to determine whether there is a next
//element in the list.
//Postcondition: Returns true if there is a next
// node in the list; otherwise
// returns false.
public boolean hasNext()
return (current != null);
//Method to remove the node currently pointed to
//by the iterator.
//Postcondition: If iterator is not null, then the
// node that the iterator points to
// is removed. Otherwise the method
// throws NoSuchElementException.
public void remove()
if (current == null)
throw new NoSuchElementException();
if (current == first)
first = first.link;
current = (LinkedListNode<T>) first;
previous = null;
if (first == null)
last = null;
else
previous.link = current.link;
if (current == last)
last = first;
while (last.link != null)
last = last.link;
current = current.link;
count--;
//Method to return the info as a string.
//Postcondition: info as a String object is returned.
public String toString()
return current.info.toString();
} //end class LinkedListIterator
//Instance variables of the class LinkedListClass
protected LinkedListNode<T> first; //variable to store the
//address of the first
//node of the list
protected LinkedListNode<T> last; //variable to store the
//address of the last
//node of the list
protected int count; //variable to store the number of
//nodes in the list
//Default constructor
//Initializes the list to an empty state.
//Postcondition: first = null, last = null,
// count = 0
public LinkedListClass()
first = null;
last = null;
count = 0;
//Method to determine whether the list is empty.
//Postcondition: Returns true if the list is empty;
// false otherwise.
public boolean isEmptyList()
return (first == null);
//Method to initialize the list to an empty state.
//Postcondition: first = null, last = null,
// count = 0
public void initializeList()
first = null;
last = null;
count = 0;
//Method to output the data contained in each node.
public void print()
LinkedListNode<T> current; //variable to traverse
//the list
current = first; //set current so that it points to
//the first node
while (current != null) //while more data to print
System.out.print(current.info + " ");
current = current.link;
}//end print
//Method to return the number of nodes in the list.
//Postcondition: The value of count is returned.
public int length()
return count;
//Method to return a reference of the object containing
//the data of the first node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the first node
// is returned.
public T front()
return first.info;
//Method to return a reference of object containing
//the data of the last node of the list.
//Precondition: The list must exist and must not be empty.
//Postcondition: The reference of the object that
// contains the info of the last node
// is returned.
public T back()
return last.info;
//Returns a copy of objects data in store.
//This method clones only the references stored in
//each node of the list. The objects that the
//list nodes point to are not cloned.
public Object clone()
LinkedListClass<T> copy = null;
try
copy = (LinkedListClass<T>) super.clone();
catch (CloneNotSupportedException e)
return null;
//If the list is not empty clone each node of
//the list.
if (first != null)
//Clone the first node
copy.first = (LinkedListNode<T>) first.clone();
copy.last = copy.first;
LinkedListNode<T> current;
if (first != null)
current = first.link;
else
current = null;
//Clone the remaining nodes of the list
while (current != null)
copy.last.link =
(LinkedListNode<T>) current.clone();
copy.last = copy.last.link;
current = current.link;
return copy;
//Method to return an iterator of the list.
//Postcondition: An iterator is instantiated and
// returned.
public LinkedListIterator<T> iterator()
return new LinkedListIterator<T>();
//Method to determine whether searchItem is in
//the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public abstract boolean search(T searchItem);
//Method to insert newItem in the list.
//Postcondition: first points to the new list
// and newItem is inserted at the
// beginning of the list. Also,
// last points to the last node and
// count is incremented by 1.
public abstract void insertFirst(T newItem);
//Method to insert newItem at the end of the list.
//Postcondition: first points to the new list and
// newItem is inserted at the end
// of the list. Also, last points to
// the last node and
// count is incremented by 1.
public abstract void insertLast(T newItem);
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list. Also, first points to the first
// node, last points to the last
// node of the updated list, and count
// is decremented by 1.
public abstract void deleteNode(T deleteItem);
public abstract void splitAt(LinkedListClass<T> secondList, T item);
}And this is the UnorderedLinked Class with the very last method the one being Im stuck on. The SplitAt Method.
public class UnorderedLinkedList<T> extends LinkedListClass<T>
//Default constructor
public UnorderedLinkedList()
super();
//Method to determine whether searchItem is in
//the list.
//Postcondition: Returns true if searchItem is found
// in the list; false otherwise.
public boolean search(T searchItem)
LinkedListNode<T> current; //variable to traverse
//the list
boolean found;
current = first; //set current to point to the first
//node in the list
found = false; //set found to false
while (current != null && !found) //search the list
if (current.info.equals(searchItem)) //item is found
found = true;
else
current = current.link; //make current point to
//the next node
return found;
//Method to insert newItem in the list.
//Postcondition: first points to the new list
// and newItem is inserted at the
// beginning of the list. Also,
// last points to the last node and
// count is incremented by 1.
public void insertFirst(T newItem)
LinkedListNode<T> newNode; //variable to create the
//new node
newNode =
new LinkedListNode<T>(newItem, first); //create and
//insert newNode before
//first
first = newNode; //make first point to the
//actual first node
if (last == null) //if the list was empty, newNode is
//also the last node in the list
last = newNode;
count++; //increment count
//Method to insert newItem at the end of the list.
//Postcondition: first points to the new list and
// newItem is inserted at the end
// of the list. Also, last points to
// the last node and
// count is incremented by 1.
public void insertLast(T newItem)
LinkedListNode newNode; //variable to create the
//new node
newNode =
new LinkedListNode(newItem, null); //create newNode
if (first == null) //if the list is empty, newNode is
//both the first and last node
first = newNode;
last = newNode;
else //if the list is not empty, insert
//newNode after last
last.link = newNode; //insert newNode after last
last = newNode; //set last to point to the
//actual last node
count++;
}//end insertLast
//Method to delete deleteItem from the list.
//Postcondition: If found, the node containing
// deleteItem is deleted from the
// list. Also, first points to the first
// node, last points to the last
// node of the updated list, and count
// is decremented by 1.
public void deleteNode(T deleteItem)
LinkedListNode<T> current; //variable to traverse
//the list
LinkedListNode<T> trailCurrent; //variable just
//before current
boolean found;
if ( first == null) //Case 1; the list is empty
System.err.println("Cannot delete from an empty "
+ "list.");
else
if (first.info.equals(deleteItem)) //Case 2
first = first.link;
if (first == null) //the list had only one node
last = null;
count--;
else //search the list for the given info
found = false;
trailCurrent = first; //set trailCurrent to
//point to the first node
current = first.link; //set current to point to
//the second node
while (current != null && !found)
if (current.info.equals(deleteItem))
found = true;
else
trailCurrent = current;
current = current.link;
}//end while
if (found) //Case 3; if found, delete the node
count--;
trailCurrent.link = current.link;
if (last == current) //node to be deleted
//was the last node
last = trailCurrent; //update the value
//of last
else
System.out.println("Item to be deleted is "
+ "not in the list.");
}//end else
}//end else
}//end deleteNode
public void splitAt(LinkedListClass<T> secondList, T item)
LinkedListNode<T> current;
LinkedListNode<T> trailCurrent;
int i;
boolean found;
if (first==null)
System.out.println("Empty.");
first=null;
last=null;
count--;
count=0;
else
current=first;
found=false;
i=1;
while(current !=null &&!found)
if(current.info.equals(item))
found= true;
else
trailCurrent=first;
current=first;
i++;
if(found)
if(first==current)
first.link=first;
last.link=last;
count--;
count=0;
else
first.link=current;
last.link=last;
last=null;
count = count- i+1;
count = i-1;
} else {
System.out.println("Item to be split at is "
+ "not in the list.");
first=null;
last=null;
count=0;
Any help or just advice would be fine. Im not the best at Java, better at VB. Am completely stumped! Thanks so much! -
Need help with ouput of a list or array of numbers input from user
I'm only a few weeks into learning java, so this may seem simple to some, but...
I am trying to write a program that will receive numbers from a user,
and then list, add, average those numbers. I've got the program to
work except for listing the numbers that were input.
Can someone help guide me????
i've left the code I've tried in as comments.
Enter an integer value, the program exits if the input is 0:
20
Enter an integer value, the program exits if the input is 0:
40
Enter an integer value, the program exits if the input is 0:
60
Enter an integer value, the program exits if the input is 0:
80
Enter an integer value, the program exits if the input is 0:
0
Total numbers entered: 4
The array of numbers is: 0 0 0 0
The sum is 200
The average is 50
The maximum number is 0
The minimum is 0
Here is my code:
* Title: Reads integers and finds the total, average, maximum of the input values
* Description:
* Copyright: Copyright (c) 2002
* Company: Duke Court.
* @author Mary Davenport
* @version 1.0
public class part3page6
public static void main(String[] args)
int data = 0;
int sum = 0;
int countnum = -1;
int maximum = 0;
int minimum = 0;
int average = (countnum - 1);
do
System.out.println("Enter an integer value, " +
" the program exits if the input is 0: ");
data = MyInput.readInt();
sum += data;
countnum++;
} while (data != 0);
//in order to figure the max & the min it appears that the
//program will need to utilize arrays to store the individual numbers
//that are input from the user.
//create an array of the input data
int[] number = new int[countnum];
//creat a list of the input data
int []myList = {data};
//lists how many numbers entered
System.out.println("Total numbers entered: " + number.length);
//list array of numbers -- this is giving me [I@3179c3,
//instead of 20, 40, 60, 80 when I use "new int[countnum]"
// System.out.print("The array of numbers is: "
// + new int[countnum]);
//list array of numbers: this is giving me " 0 0 0 0 "
//instead of 20, 40, 60, 80 with the following for statement
// (number[i] + " ")
System.out.print("The array of numbers is: ");
for(int i=0; i<number.length; i++)
System.out.print(number[i] + " ");
//list mylist of numbers from input, 20, 40, 60, 80
//output is The list of numbers is: [I@3179c3
// System.out.print("The list of numbers is: " + myList);
System.out.println();
System.out.println("The sum is " + sum);
average = sum/countnum;
System.out.println("The average is " + average);
System.out.println("The maximum number is " + maximum);
System.out.println("The minimum is " + minimum);When you input the data you need to save it to the array. Currently you are not saving the value you are just adding it
ArrayList nums = new ArrayList();
do
System.out.println("Enter an integer value, " +
" the program exits if the input is 0: ");
data = MyInput.readInt();
nums.add(new Integer(data));
sum += data;
countnum++;
} while (data != 0); -
Help with multipule drop down lists in a select query
Hi I am trying to design a search query using 5 drop down lists coming from tables. the front end looks like this
I have the selections going to variables then by $_POST into the msqyl query my other code is
MY CODE FOR THE FORM IS
<form action="horse-events-devon.php?url_countyid=<?php echo urlencode ($url_countyid ['url_countyid']) ; ?>&go" method="POST">
<table id="searchtable">
<tr>
<th>Find By Discipline</th>
<th>Find By Venue</th>
<th>Find By Championship</th>
<th>Find By Organiser</th>
<th>Equine Association</th>
<th>Submit Your Selections</th>
</tr>
<tr>
<td><select name="dis_id">
<?php
$upcomingdis = upcomingdis($url_countyid);
$upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis);
?>
<?php
do {
?> <option value="<?php echo $upcoming_dis_bycounty ['dis_id']; ?>" >
<?php echo $upcoming_dis_bycounty ['dis_description']; ?></option>
<?php
} while ($upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis));
?></select></td>
<td><select name="ven_id">
<?php
$upvenbycounty_set = upcoming_venevents_bycounty($url_countyid);
$upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set);
?>
<?php
do {
?> <option value="<?php echo $upcoming_ven_bycounty ['ven_id']; ?>" >
<?php echo $upcoming_ven_bycounty ['ven_name']; ?></option>
<?php
} while ($upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set));
?></select></td>
<td><select name="champ_id">
<?php
$championship_set = findchampionships();
$champlist = mysql_fetch_assoc ($championship_set);
?>
<?php
do {
?> <option value="<?php echo $champlist ['champ_id']; ?>" >
<?php echo $champlist ['champ_description']; ?></option>
<?php
} while ($champlist = mysql_fetch_assoc ($championship_set));
?></select></td>
<td>
<select name="org_id">
<?php
$uporgbycounty_set = upcoming_organevents_bycounty($url_countyid);
$upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set);
?>
<?php
do {
?> <option value="<?php echo $upcoming_org_bycounty ['org_id']; ?>" ><?php echo $upcoming_org_bycounty ['org_name']; ?></option>
<?php
} while ($upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set));
?></select>
</td>
<td><select name="***_id">
<?php
$upassbycounty_set = upcoming_assevents_bycounty($url_countyid);
$upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set);
?>
<?php
do {
?> <option value="<?php echo $upcoming_assbycounty ['***_id']; ?>" >
<?php echo $upcoming_assbycounty ['***_description']; ?></option>
<?php
} while ($upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set));
?></select></td>
<td><input name="submit" type="submit" /><input name="countyid" type="hidden" value="<?php echo $url_countyid ['url_countyid']; ?>" /></td>
</tr>
</table>
</form>
<?php
if (isset($_POST['submit'])){
if (isset($_GET['go'])){
$countyid = $_POST['countyid'];
$ven_id = $_POST['ven_id'];
$dis_id = $_POST['dis_id'];
$champ_id = $_POST['champ_id'];
$org_id = $_POST['org_id'];
$event_id = $row['event_id'];
$sql = "SELECT DATE_FORMAT (events.startdate, '%a, %d, %b')
AS stdate, events.event_id, events.title, events.ven_id, events.org_id,
venue.county_id, venue.ven_id, eventdisciplines.event_id, eventdisciplines.dis_id, county.county_id, discipline.dis_id \n"
. "FROM events \n"
. "LEFT OUTER JOIN eventdisciplines \n"
. "ON events.event_id = eventdisciplines.event_id \n"
. "LEFT OUTER JOIN discipline \n"
. "ON eventdisciplines.dis_id = discipline.dis_id \n"
. "LEFT OUTER JOIN venue \n"
. "ON events.ven_id = venue.ven_id \n"
. "LEFT OUTER JOIN county \n"
. "ON venue.county_id = county.county_id \n"
. "WHERE events.ven_id = ({$ven_id} OR events.org_id = {$org_id})\n"
. "AND events.startdate > NOW()\n"
. "AND venue.county_id = {$countyid} \n"
. "ORDER BY startdate ASC";
$result = mysql_query ($sql, $connection);
?>
My problem is at the WHERE point, how do I code for single and multipule selections, The . "WHERE events.ven_id = ({$ven_id} OR events.org_id = {$org_id})\n" throws and error.
How am I best programing this type of query, ?? Should it be with php ??The best thing is to dynamically build your where clause based on the user selection. Test the values of all form fields and if the user does not make a selection, do not include that in the where clause.
Trying to build a single, static where clause that accounts for all possible user input permutations is extremely difficult. -
Help with creating a price list
I'm just wondering if anybody could possibly help me when creating a price list?. I'm new to SAP so don't have a great knowledge of it.
Our company needs to send out a wholesale price list to customers, however some of the items we stock do not include vat, when the price list is previewed it doesnt show which items include vat or exclusive of vat. this information could do with being visible to make it clearer to the customers.
Is there anyway the priclist could be exported to microsoft excel etc for editing?
many thanks.go to inventory--prce lists-Price List.
double click on the price list you want.
It will open the new window showing Items with prices.
Click on the Excel icon on menu bar on the top.
save file as .xls. -
Need help with creating invoice and list of invoices
Hello everybody,
I need to create Credit / Debit memo invoices and for this I try to use FM GN_INVOICE_CREATE in my Z program, please let me know if it is correct way to go?
As well I need to create list of Credit / Debit memo invoices, how to achieve this?
Thanks in advance.
Usefull answers will be awarded.
Regards, M.You can use RV_INVOICE_CREATE for credit memo and debit memo
list of credit and debit memo - use this FM - RV_INVOICE_LIST_CREATE
see the below sample code
refresh: XKOMFK, XKOMV,
XTHEAD, XVBFS,
XVBPA, XVBRK,
XVBRP, XVBSS.
clear : XKOMFK, XKOMV,
XTHEAD, XVBFS,
XVBPA, XVBRK,
XVBRP, XVBSS,
VBSK_I.
VBSK_I-SMART = 'F'.
XKOMFK-VBELN = v_deliv.
XKOMFK-VBTYP = 'J'.
APPEND XKOMFK.
CALL FUNCTION 'RV_INVOICE_CREATE'
EXPORTING
VBSK_I = VBSK_I
WITH_POSTING = 'C'
TABLES
XKOMFK = XKOMFK
XKOMV = XKOMV
XTHEAD = XTHEAD
XVBFS = XVBFS
XVBPA = XVBPA
XVBRK = XVBRK
XVBRP = XVBRP
XVBSS = XVBSS.
if sy-subrc eq 0.
COMMIT WORK.
flag = 'X'.
else.
message i011 with p_vbeln.
endif.
Reward Points if it is helpful
Thanks
Seshu
Maybe you are looking for
-
For some reason my adobe flash player will not load or reinstall. I keep getting a screen from adobe that says quit or intall but there is no button for the install to push. Only the quit is useable. I want to be able to view video but can't. Does th
-
how can i connect my macbook pro wirelessly to an hp printer with a asus rt 66acr router?
-
Not enough memory problem nokia 2700 help plz
I have nokia 2700c and today i updated using pc suite to the latest v09.98 i had an error telling Not enough memory when im playing music or video or fm.. i updated and also did twice even i made restore but still problem is same.. how to recover fr
-
All of the sudden, I can't upload picture files to my processor. I just uploaded a couple days ago and everything worked fine. I've checked file (ready to read and write) and made sure the file was unlocked. Pictures inside file are transparent. I ca
-
Two idocs are created for one output message type
hi all, we are communicating our sap idocs to external system using ALE.It is working smoothly. Our problem raises here, .idocs are creating at the time of output type attachment for purchase orders.But rarely,two idocs are creating for one message t