Strings in a switch?
I would like to give my switch-statement a string, but that does not seem to work, is it possible in any way?
public void test(String str) {
switch(str){
case "Green":{
System.out.println("The color is green");}
case "Blue":{
System.out.println("The color is blue");}
}
Java should supports String in a switch statement; however, it should not supports Object (as pointed out in previous reply). Only problem i see is the implementation. Since String is an Object, then wouldn't swicth (obj) works as well. THe compiler would not catch this..but runtime can (if the implementation check to make sure the object is an instance of a String). and frankly, i don't wnt to do a try..catch on a switch statement to catch runtime error...The main purpose of a switch(String) is to make the code more readable.
I think this is the reason Java exclude String in the switch statement. If you include String, then you must include Object...but how do we compare object? by equals(), hashcode(), reference, or toString().equals(toString())? from the look of it, any comparison is valid..which is the problem because there must be one uniform comparison everyone must agree with to make it work. unfortunately, we know not everyone will agree on which is the best way to perform the comparison.
still..it would be nice to do switch(myString)
Similar Messages
-
Is it possible to do a switch with a String?
The following does not seem to work
String a = "bubble";
switch(a) {
case "tricks":
System.out.println("This trick doesn't seem to work");
break;
case "bubble":
System.out.println("It's gone and burst my bubble");
break;
}Any ideas?
Thanks
BubbleBrannor:
E.g. switch (testString.hashCode()) {
case ("case 1".hashCode())...This won't work. You need a constant expressions for the cases, a method like hashCode() won't work there.
Yogee:
1. Different Strings are not guaranteed to generate different hashcodes.True, but its such a unlikely event that the strings' hashcodes will be equal that someone would still be able to do this reasonably in some situations. but I wouldn't do this in my code
2. The algorithm used to generate the hashcode is not guaranteed to be the same on different platforms.There is a String hashcode formula, and its not ambiguous. The method is implemented entirely in java and so it will be the same on different platforms. Object.hashCode() though can be different on different platforms.
3. The algorithm used to generate the hashcode is not guaranteed to be the same on different
java versions.We can use that argument against writing anything in the API though, since the language can always change. Has Sun ever indicated that they might want to change the API specs for Strings's hashCode? -
I'm attaching a file that may help. Just remember this is my FIRST attempt at using NI/FeildPoint so things that would be obvious to the normal users more than likely would slide right by me. So I'll try and explain what the text contains as to make my problem more clear. I'm using a FP-1000, FP-AI-100, and a FP-TB-10. i'm creating a application where I'm using the 8 channels from the FP-AI-100 to monitor a control system ,that we manufacture. The control system is in an environmental chamber. I use the FP-TB-10 to monitor the temperature while in the chamber. The control system is ran for 4 hours under varing enviromental conditions while I monitor vital system voltages with the FP-AI-100. Now the application that i'm building starts with the obvious FP CREATE.VI and so forth I have no problem communicating with the FP's, but the information that I'm monitioring needs to be placed into a file with Headers describing the information below it. Now I use a "WHILE LOOP.VI" to monitor the FP-AI-100 & FP-TB-10 for the 4 hour period. but before that I create and open a file where I use a "CONCATENATE STRINGS.VI" to enter the headers I need. I do this by CONSTANTS, CONTROLS, TABs, AND CARRIAGE RETURN being entered into the "CONCATENATE STRINGS.VI" in the order I want them to appear. I use ROW 1 to enter (OPERATOR:with a CONSTANT) an a (CONTROL so the operator may enter his name and be recorded into the file) using a TAB to seperate Columns and a CARRIAGE RETURNto drop down to ROW 2 for the next headers. I use header names and TABs to seperate the columns. This part works great. I end up with ROW 1 having the operator information then ROW 2 having the headers for all the channels I'm using to monitor the control system with in their own column. The trouble happens when I write to this file during the "WHILE LOOP". The information recorded for DATE:, TIME:, and Channel 0 of the FP-AI-100 end up right under their corresponding header on ROW 3, but the rest of the data ends up on ROW 4 in column 3 and goes down many rows with some of the data not being stored at all. It varies on how many rows are used starting at ROW 4 but hey always stay in column 3. I use the "FP READ.VI" outputing to a "ARRAY TO SPREADSHEET STRING.VI" outputing to a "CONCATENATE STRINGS.VI" for each channel within the "WHILE LOOP" then into the "WRITE.VI". I use the "CONCATENATE STRINGS.VI" to place my data OR atleast I thought you could do that some how I'm not quit doing something write either there is a sampling/timing issue or writing to file issue where things are being confused in the "WHILE LOOP" if someone know a better route to perform what I'm tring here I would be interested. Its not like I'm not giving it the old colledge try here but without proper training and the vagness of the manuals it's difficult to understand what every connection actually does.I'm tring though for everyone who happens to fill pity for me
Thanks for your help
John Morris
Glendinning Marine Product, Inc.
Attachments:
ALLchannels 273 KB> I appreciate your effort to help me, but there is still a slight cloud
> in front of my eyes here.(I must mention that I'm using Labview 5.1
Oh, to bad. I'm using LV 6,02 and tried to save the application as LV5.1,
but it didn't work.
> Lets start with the easy one which is the SECOND main thing you
> wanted to mention. In my application I used individual Create Tag.vi's
> "so your saying that I can use just one Create Tag.vi and one Read.vi
> and what ever I use to display the values will automatically to show
> the individual channels" in other words if I use a "Indicator(DBL)"
> comming out of the Read.vi what ever I use in the "PANEL" layout will
> expand to show all 8 channel if I was using a FP-AI-100? Cool...
Allmost right. The 8 channels come out as 1D-array, ch0...ch7.
> #1--How do I change the delimiter (TAB) to a delimiter (comma) in a
> Array to Spreadsheet String.vi?
> ...cut
I don't use this Spreadsheet VI, because files coming out there allways
start this time consuming EXCEL wizzard. Because of this, I programmed my
own CSV-conversion vi. Maybe you could just use a common texteditor, like
wordpad and put the csv-examples from my last reply down to a text file
and rename it to *.csv. Texteditors terminate lines with "\r\n" by
default, so this is a very quick way for testing.
> FP_Analog_Logging example to record all eight channels it uses a Array
I didn't find the vi you metione above, but there is another good one:
Look at examples\FieldPoint\DataLogging\FP Logger.vi.
In a little case structure, at "false", there is a function called "Format
into string".
Pop up on the format string and adjust >>'\' Codes Display<<.
Then you change the format string into: %.;%-f%s
A Tab string is connected to the lower input of this function. Replace
this one with a comma.
That should do.
>
> #2--If using just one Create Tag.vi and one Read.vi and I have the
> Item Name listed as ALL I take it that the information comming out of
> the Read.vi is data for each channel in a String format starting with
> channel 0 and ending with channel 7 for the FP-AI-100.
Yes, just as explained above. If you put a indicator at the output to
display the values, you can expand the display to show all 8 channels, but
you can't name induvidual cells. In a array, all cells have identical
named labels. If you want to name the individually, you have to attach the
array to cluster function and put the indicator after this one. Enable
labe display and name the output values individually.
> #3--Now I use the following to "Format String" in the Array to
> Spreadsheet string.vi (%.4f)but I don't see anyway of changing the
> delimiter from (TAB) to (COMA)
Explained above.
> #4 you stated text strings need a "as prefix and sufix" and each
> string is seperated by a coma, a period is used as decimal number
> separator and lines have to be terminated by my question is
> WHERE IS THIS ACCOMPLISHED? WHAT VI OR WHAT CONNECTOR PIN?
Well, modifying strings are done with string functions.
Above, as I explained how the sample FP Logger.vi can be modified to do
the job for numbers. The pre- and suffixing with ", you only need for
strings, which EXCEL should interpret a string and as nothing else as a
string, even if there's a number inside. You usually need this only for
headers. So its easyest, if you just write your string into a string
constant or control and concatenate it to the previous csv-file contents.
Oh, I just see by looking at the above mentioned example... Inside the
case structure, but in the "true" case, there are error messages
concatenated to the logfile. At this point it is importent, to use " for
integrating the message into the CSV file, because a error message usually
looks like this: >> ERROR 2345 in vi yxz <<
Here you have text and number strings mixed in one line. EXCEL does not
know, if it should interpret the number inside the error line as separate
number, separating the line into three colums i.e. string before number,
number and string after number. So tell EXCEL by putting a " before and
after the line each.
For this, expand the Format To String function by one input, move down all
connections, to be able to insert a string constant with a " to the first
argument connector. Change the contents of the string constant at the
bottom argument from tab to ", (quotation mark AND comma)
> #5 You gave me an example of what a 3 column header could look like:
> "col0","col1","col2"\r\n Now is this something that you enter
> somewhere cause I know that \r is carriage return and \n is newline so
> I take it that the above is entered somewhere maybe in the Write.vi to
> the connector called Header (F)? See this is what confuses me because
> NI manuals have no examples of certain connectors types being used or
> any reference as to how they manipluate data with there varing type
> inputs. Or maybe I'm just missing them.
The example I mentioned above help here to.
Look at the Write File function. This function receves data from a
function named concatenate strings. Expand this function to have one more
spare input at the bottom. Create a string constant. Switch the constant
display to "\" mode. Enter "col0","col1","col2"\r\n into the constant.
Connect the constant to the spare input.
Doing this, every dataline in the csv file is followed by
"col0","col1","col2"\r\n .
I wish you a nice weekend,
Rainer Ehrt -
Using a Switch statement for Infix to Prefix Expressions
I am stuck on the numeric and operator portion of the switch statement...I have the problem also figured out in an if/else if statement and it works fine, but the requirements were for the following algorithm:
while not end of expression
switch next token of expression
case space:
case left parenthesis:
skip it
case numeric:
push the string onto the stack of operands
case operator:
push the operator onto the stack of operators
case right parenthesis:
pop two operands from operand stack
pop one operator from operator stack
form a string onto operand stack
push the string onto operand stack
pop the final result off the operand stack
I know that typically case/switch statement's can only be done via char and int's. As I said I am stuck and hoping to get some pointers. This is for a homework assignment but I am really hoping for a few pointers. I am using a linked stack class as that was also the requirements. Here is the code that I have:
import java.io.*;
import java.util.*;
import java.lang.*;
/*--------------------------- PUBLIC CLASS INFIXTOPREFIX --------------------------------------*/
/*-------------------------- INFIX TO PREFIX EXPRESSIONS --------------------------------------*/
public class infixToPrefix {
private static LinkedStack operators = new LinkedStack();
private static LinkedStack operands = new LinkedStack();
// Class variable for keyboard input
private static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
// Repeatedly reads in infix expressions and evaluates them
public static void main(String[] args) throws IOException {
// variables
String expression, response = "y";
// obtain input of infix expression from user
while (response.charAt(0) == 'y') {
System.out.println("Enter a parenthesized infix expression."); // prompt the user
System.out.println("Example: ( ( 13 + 2 ) * ( 10 + ( 8 / 3 ) ) )");
System.out.print("Or as: ((13+2)*(10+(8/3))): ");
expression = stdin.readLine(); // read input from the user
// output prefix expression and ask user if they would like to continue
System.out.println("The Prefix expression is: " + prefix(expression)); // output expression
System.out.println("Evaluate another? y or n: "); // check with user for anymore expressions
response = stdin.readLine(); // read input from user
if (response.charAt(0) == 'n') { // is user chooses n, output the statement
System.out.println("Thank you and have a great day!");
} // end if statement
} // end while statement
} // end method main
/*------------- CONVERSION OF AN INFIX EXPRESSION TO A PREFIX EXPRESSION ------------*/
/*--------------------------- USING A SWITCH STATEMENT ------------------------------*/
private static String prefix(String expression) {
// variables
String symbol, operandA, operandB, operator, stringA, outcome;
// initialize tokenizer
StringTokenizer tokenizer = new StringTokenizer(expression, " +-*/() ", true);
while (tokenizer.hasMoreTokens()) {
symbol = tokenizer.nextToken(); // initialize symbol
switch (expression) {
case ' ':
break; // accounting for spaces
case '(':
break; // skipping the left parenthesis
case (Character.isDigit(symbol.charAt(0))): // case numeric
operands.push(symbol); // push the string onto the stack of operands
break;
case (!symbol.equals(" ") && !symbol.equals("(")): // case operator
operators.push(symbol); // push the operator onto the stack of operators
break;
case ')':
operandA = (String)operands.pop(); // pop off first operand
operandB = (String)operands.pop(); // pop off second operand
operator = (String)operators.pop(); // pop off operator
stringA = operator + " " + operandB + " " + operandA; // form the new string
operands.push(stringA);
break;
} // end switch statement
} // end while statement
outcome = (String)operands.pop(); // pop off the outcome
return outcome; // return outcome
} // end method prefix
} // end class infixToPrefixAny help would be greatly appreciated!so, i did what flounder suggested:
char e = expression.charAt(0);
while (tokenizer.hasMoreTokens()) {
symbol = tokenizer.nextToken(); // initialize symbol
switch (e) {
case ' ':
break; // accounting for spaces
case '(':
break; // skipping the left parenthesis
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
operands.push(symbol); // push the string onto the stack of operands
break; // case numeric
case '+':
case '-':
case '*':
case '/':
operators.push(symbol); // push the operator onto the stack of operators
break; // case operator
case ')':
operandA = (String)operands.pop(); // pop off first operand
operandB = (String)operands.pop(); // pop off second operand
operator = (String)operators.pop(); // pop off operator
stringA = operator + " " + operandB + " " + operandA; // form the new string
operands.push(stringA);
break;
default:
} // end switch statement
} // end while statement
outcome = (String)operands.pop(); // pop off the outcome
return outcome; // return outcomeafter this, I am able to compile the code free of errors and I am able to enter the infix expression, however, the moment enter is hit it provides the following errors:
Exception in thread "main" java.lang.NullPointerException
at LinkedStack$Node.access$100(LinkedStack.java:11)
at LinkedStack.pop(LinkedStack.java:44)
at infixToPrefix.prefix(infixToPrefix.java:119)
at infixToPrefix.main(infixToPrefix.java:59)
Any ideas as to why? I am still looking through seeing if I can't figure it out, but any suggestions? Here is the linked stack code:
public class LinkedStack {
/*--------------- LINKED LIST NODE ---------------*/
private class Node {
private Object data;
private Node previous;
} // end class node
/*-------------- VARIABLES --------------*/
private Node top;
/*-- Push Method: pushes object onto LinkedStack --*/
public void push(Object data) {
Node newTop = new Node();
newTop.data = data;
newTop.previous = top;
top = newTop;
} // end function push
/*--- Pop Method: pop obejct off of LinkedStack ---*/
public Object pop() {
Object data = top.data;
top = top.previous;
return data;
} // end function pop
} // end class linked stackEdited by: drmsndrgns on Mar 12, 2008 8:10 AM
Edited by: drmsndrgns on Mar 12, 2008 8:14 AM
Edited by: drmsndrgns on Mar 12, 2008 8:26 AM -
Here's my dilemma,
I'm trying to write a program that takes a user input ZIP Code and then outputs the geographical area associated with that code based on the first number. My knowledge of Java is very, very basic but I was thinking that I could do it with the charAt method. I can get the input fine and isolate the the first character but for some reason the charAt method is returning a number like 55 (that's what I get when it starts with 7). Additionally, to use the charAt my input has to be a String and I can't use a String with the switch statement. To use my input with the Switch statement I have to make the variable an int. When I do that however, I can't use the charAt method to grab the first digit. I'm really frustrated and hope someone can point me in the right direction.
Here's what I have so far:
import java.util.Scanner;
public class ZipCode
public static void main(String[] args)
// Get ZIP Code
int zipCodeInput;
Scanner stdIn = new Scanner(System.in);
System.out.print("Please enter a ZIP Code: ");
zipCodeInput = stdIn.nextInt();
// Determine area of residence
switch (zipCodeInput)
case 0: case 2: case 3:
System.out.println(zipCodeInput + " is on the East Coast");
break;
case 4: case 5: case 6:
System.out.println(zipCodeInput + " is in the Central Plains area");
break;
case 7:
System.out.println(zipCodeInput + " is in the South");
break;
case 8: case 9:
System.out.println(zipCodeInput + " is int he West");
break;
default:
System.out.println(zipCodeInput + " is an invalid ZIP Code");
break;
}Fmwood123 wrote:
Alright, I've successfully isolated the first number in the zip code by changing int zipCodeChar1 into char zipCodeChar1. Now however, when I try to run that through the switch I get the default message of <ZIP> is an invalid ZIP Code. I know that you said above that switch statements were bad so assume this is purely academic at this point. I'd just like to know why it's not working.
import java.util.Scanner;
public class ZipCode
public static void main(String[] args)
// Get ZIP Code
String zipCodeInput;
char zipCodeChar1;
Scanner stdIn = new Scanner(System.in);
System.out.print("Please enter a ZIP Code: "); // Input of 31093
zipCodeInput = stdIn.nextLine();
System.out.println("zipCodeInput is: " + zipCodeInput); // Retuns 31093
zipCodeChar1 = zipCodeInput.charAt(0);
System.out.println("zipCodeChar1 is: " + zipCodeChar1); // Returns 3
// Determine area of residence
switch (zipCodeChar1)
case 0: case 2: case 3:
System.out.println(zipCodeInput + " is on the East Coast");
break;
case 4: case 5: case 6:
System.out.println(zipCodeInput + " is in the Central Plains area");
break;
case 7:
System.out.println(zipCodeInput + " is in the South");
break;
case 8: case 9:
System.out.println(zipCodeInput + " is int he West");
break;
default:
System.out.println(zipCodeInput + " is an invalid ZIP Code");
break;
When you print the char '7' as a character you will see the character '7', but char is really a numeric type: think of it as unsigned short. To convert '0'...'9' to the numbers 0...9, do the math:
char ch = ...
int digit = ch - '0';edit: or give your cases in terms of char literals:
case '0': case '2': case '3': -
Question about "switch" statement
hi all I am new to Java programming..
I have one problem that is
I would like to use switch statement like below
in the switch statement can we use only integers ?
but i am using string it is not supporting ..
for strings like below what I have to do...
String temp = "str2";
switch(temp){
case "str1":
case "str2":
case "str3":
case "str4":
please send the solution if anyone knows
thanksWhat do you mean by a smart hash?At least smarter than String.hashCode ().
Don't think so - char, byte, short, or int.You're correct - seems I've got to test things before I post. So it's safe to say that a switch works on anything that can be treated as an int? -
Is it possible to sort or filter the switch routes under the switching tab?
In Teststand 3.1, is it possible to filter the switch routes under the switching tab in Action Properties? Since I have a large amount of routes that have been created in Switch Executive, how can I filter out some of the routes from the "Routes to Connect" section?
The TestStand Switching does not provide any inherent filtering capabilities. You do have a couple of options, however.
(1) NI-Switch provides the ability to set up route connections in
different groups. The Switch Page in TestStand allows you to
select Routing groups as well as specific Routes. It may be
easier for you to organize your Connections as groups and choose
between different groups.
(2) The Property page also allows you to build route connection
string and use that string for your Switching actions. It
may be easier for you to build a Route string and easily change that
string rather than selecting your routes everytime from within the
TestStand window.
Good Luck!
Tyler T.
Applications Engineer
National Instruments -
Using Stringvariables with switch-Keyword ?
Hallo !
I am a JAVA newcomer from Austria.
I know the Keyword switch and case,
but it is not possible to compare Stringvariables.
Is there an other command to do this or
how do you compare Stringvariables with the case-Statement ?
Thank you for your answer.
Wolfgang KLDHmmm....
From Java Lang Spec 2 14.10:
SwitchLabel:
case ConstantExpression :
The type of the expression must be char, byte, short or int...
.From Java Lang Spec 2 15.28:
A compile-time constant expression...following:
Simple names that refer to final variables whose
initializers are constant expressions.
.And this doesn't compile (with jikes nor jdk 1.3)
static final int h1 = "value1".hashCode();
static void test() throws Exception
String s = "value1";
switch(s.hashCode())
case h1: System.out.println("value1 it is");
default:
System.out.println("no such luck");
It must be the phrase 'whose initializers are constant expressions' that does it in. -
Sorry, if my question is too wordy.
First, the problem -- I am reading integers into my application and converting the those into strings using valueOf(). I then need to use those strings in a switch statment. The only way I could figure how to do this was to use the same String variable in each switch statement but change the the message to fit each case. My professor suggested I use an array list instead.
Second, the question -- how can I convert the String I have generated into a String Array and use the indexing of the array to correspond to the specific text for each case?
Thank you.indeed, you can't use the switch mechanism on strings.
but, if the requirement is that you convert an integer into a string and then switch on those (I don't know why...) from an array of the values, swap the String value back into an int and switch from there. -
Hi all,
I am having the following problem. I have written the program below which I want to work as follows. The user will enter a letter between A and J, which then will be checked using a switch structure for a valid input.
System.out.println("Please enter the first letter of your guess, then press enter: ");
letter1 = console.next();
if (letter1 >= 'A' && letter1 <= 'J')
switch (letter1)
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J': return true;
else
System.out.println("Invalid selection. Please try again");
System.out.println("Please enter the second letter of your guess, then press enter: ");
letter2 = console.next();
___However when I try to compile it the following errors occur;___
Gameoutput2.java:43: operator >= cannot be applied to java.lang.String,char
if (letter1 >= 'A' && letter1 <= 'J')
^
Gameoutput2.java:43: operator <= cannot be applied to java.lang.String,char
if (letter1 >= 'A' && letter1 <= 'J')
^
Gameoutput2.java:45: incompatible types
found : java.lang.String
required: int
switch (letter1)
^
Gameoutput2.java:56: cannot return a value from method whose result type is void
case 'J': return true;
Can anyone see any problems?* You check whether the letter is valid, but if it's not, you just print a message, you don't make them enter a new one before moving on to the second letter.
Okay so far I have done the following;
System.out.println("Please enter the first letter of your guess, then press enter: ");
char myChar = letter1.charAt(0);
if(myChar >= 'A' && myChar <= 'J')
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J': return true;
else
System.out.println("Invalid selection. Please try again");
System.out.println("Please enter the second letter of your guess, then press enter: ");
How can I make the 'if' structure "loop" back to make the user re-enter a valid char? -
Besides a RW community string...
Besides a RW community string on Wired switches and routers in Prime Infrastructure, are there any other special configurations required (on the Wired switch or router side) in order for the templates to be deployed.
Reason I'm asking is in my lab when I go to deploy canned templates, there aren't any devices that show in the available devices list....granted I have only 1-3560 Wired switch setup at this time.
Also I saw a couple of instances today on different builds where I was able to see devices in the list:::
thanks for any feedback.
robit was a browser problem:::
-
Hi,
my Servlet computes a request (doGet()-method) with some parameters (e.g. http://myApp/test?param=Hello).
Then it forwards to another servlet/jsp:
request.getRequestDispatcher("/mySite").forward(request, response);
But before forwarding, I want to remove the parameters! How can I do this?
I cannot find a method like "request.removeParamter(param)" in the API!
Thanks
Daniel :-)Hi everyone.
I had a similar problem and I've resolved it with a workaround: I needed to forward a Servlet to the Servlet itself, for multiple data posting, so I used a request attribute to determine if I was processing the first call or the next ones.
I think this workaround will work also when you must forward Servlet1 to Servlet2.
Here's the code:
In the first time call (or in Servlet1):
if (...some conditions...) {
// Instead of removing parameter...
request.setAttribute("switch","Y");
In the next calls (or in Servlet2):
String par = null;
String switch = (String)request.getAttribute("switch");
if (switch == null) {
par = (String)request.getParameter("par");
I know that in this way the "par" parameter is not really removed, however, if you managed the attribute "switch" correctly, it would be null.
Don't forget to remove the attribute from the request when you no longer need it. Let's clean our junks... ;-)
Hope this helps.
Carlo -
New Windows server 2003 Hyper-V guest fails to boot
Hello,
I'm currently doing some virtualization experiments on my new server hardware. The host hardware is:
IBM x3650 M4
x2 Xeon E5-2609
32GB RAM
x2 480 GB SSDs
Server OS: Windows server 2012
I'd like to test some legacy app virtualization. I've configured a VM and have installed Windows server 2003. The install is done via DVD. The issue at hand is that after the initial installation, the server fails to boot. The VM goes into a reboot loop
and so far the only error logging I'm able to find is in the hosts event log.
Log Name: Microsoft-Windows-Hyper-V-Worker-Admin
Source: Microsoft-Windows-Hyper-V-Worker
Date: 7/8/2014 2:14:48 PM
Event ID: 18560
Task Category: None
Level: Critical
Keywords:
User: NT VIRTUAL MACHINE\A0D20FA4-B27B-4B58-85C1-87D74B0ADD2D
Computer: CCSTS1.cnet2k.cornerstonecredit.net
Description:
'LegacyTS' was reset because an unrecoverable error occurred on a virtual processor that caused a triple fault. If the problem persists, contact Product Support. (Virtual machine ID A0D20FA4-B27B-4B58-85C1-87D74B0ADD2D)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Hyper-V-Worker" Guid="{51DDFA29-D5C8-4803-BE4B-2ECB715570FE}" />
<EventID>18560</EventID>
<Version>0</Version>
<Level>1</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2014-07-08T21:14:48.544007000Z" />
<EventRecordID>159</EventRecordID>
<Correlation />
<Execution ProcessID="1512" ThreadID="3536" />
<Channel>Microsoft-Windows-Hyper-V-Worker-Admin</Channel>
<Computer>CCSTS1.cnet2k.cornerstonecredit.net</Computer>
<Security UserID="S-1-5-83-1-2698121124-1264104059-3615998341-769460811" />
</System>
<UserData>
<VmlEventLog xmlns:auto-ns2="http://schemas.microsoft.com/win/2004/08/events" xmlns="http://www.microsoft.com/Windows/Virtualization/Events">
<VmName>LegacyTS</VmName>
<VmId>A0D20FA4-B27B-4B58-85C1-87D74B0ADD2D</VmId>
<Rax>0x0</Rax>
<Rbx>0x0</Rbx>
<Rcx>0x0</Rcx>
<Rdx>0x0</Rdx>
<Rsp>0x804de00c</Rsp>
<Rbp>0x0</Rbp>
<Rsi>0x0</Rsi>
<Rdi>0x0</Rdi>
<R8>0x0</R8>
<R9>0x0</R9>
<R10>0x0</R10>
<R11>0x0</R11>
<R12>0x0</R12>
<R13>0x0</R13>
<R14>0x0</R14>
<R15>0x0</R15>
<Rip>0x80547c7c</Rip>
<Rflags>0x10046</Rflags>
<FpControlStatus>7F030000000000000000000000000000</FpControlStatus>
<XmmControlStatus>0000000000000000801F0000FFFF0000</XmmControlStatus>
<Cr0>0x8001003d</Cr0>
<Cr2>0x804ddffc</Cr2>
<Cr3>0xa02000</Cr3>
<Cr4>0x20</Cr4>
<Cr8>0xf</Cr8>
<Xfem>0x1</Xfem>
<Dr0>0x0</Dr0>
<Dr1>0x0</Dr1>
<Dr2>0x0</Dr2>
<Dr3>0x0</Dr3>
<Dr6>0xffff0ff0</Dr6>
<Dr7>0x400</Dr7>
<Es>0000000000000000FFFFFFFF2300F3C0</Es>
<Cs>0000000000000000FFFFFFFF08009BC0</Cs>
<Ss>0000000000000000FFFFFFFF100093C0</Ss>
<Ds>0000000000000000FFFFFFFF2300F3C0</Ds>
<Fs>00F0DFFF00000000FF1F0000300093C0</Fs>
<Gs>0000000000000000FFFFFFFF00000000</Gs>
<Ldtr>00000000000000000000000000000000</Ldtr>
<Tr>90685580000000006800000050008B00</Tr>
<Idtr>000000000000FF0700F4038000000000</Idtr>
<Gdtr>000000000000FF0300F0038000000000</Gdtr>
<Tsc>0x148e4294</Tsc>
<ApicBase>0xfee00900</ApicBase>
<SysenterCs>0x0</SysenterCs>
<SysenterEip>0x0</SysenterEip>
<SysenterEsp>0x0</SysenterEsp>
</VmlEventLog>
</UserData>
</Event>
My VM config
<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
<configuration>
<_24984ed0-bdad-4b90-82b2-5d59f874e91e_>
<ChannelInstanceGuid type="string">{E4E9CD0E-4BBF-4C1B-B655-715781690655}</ChannelInstanceGuid>
</_24984ed0-bdad-4b90-82b2-5d59f874e91e_>
<_7d80d3db-61ee-4879-8879-5609f1100ad0_>
<address type="string">5353,00000000,00</address>
<version type="integer">1</version>
</_7d80d3db-61ee-4879-8879-5609f1100ad0_>
<_83f8638b-8dca-4152-9eda-2ca8b33039b4_>
<controller0>
<drive0>
<pathname type="string">E:\Hyper-V\VHD\LegacyTS.vhdx</pathname>
<pool_id type="string"></pool_id>
<type type="string">VHD</type>
</drive0>
<drive1>
<pathname type="string"></pathname>
<type type="string">NONE</type>
</drive1>
</controller0>
<controller1>
<drive0>
<pathname type="string">SCSI\CDROM&VEN_IBM_SATA&PROD_DEVICE_81Y3681\4&1864BF9E&0&010000</pathname>
<pool_id type="string"></pool_id>
<type type="string">ISO</type>
</drive0>
<drive1>
<pathname type="string"></pathname>
<type type="string">NONE</type>
</drive1>
</controller1>
<version type="integer">5</version>
</_83f8638b-8dca-4152-9eda-2ca8b33039b4_>
<_8e3a359f-559a-4b6a-98a9-1690a6100ed7_>
<port0>
<connection type="string"></connection>
</port0>
<port1>
<connection type="string"></connection>
</port1>
<version type="integer">2</version>
</_8e3a359f-559a-4b6a-98a9-1690a6100ed7_>
<_8f0d2762-0b00-4e04-af4f-19010527cb93_>
<controller0>
<drive0>
<pathname type="string"></pathname>
<type type="string">VFD</type>
</drive0>
</controller0>
<version type="integer">1</version>
</_8f0d2762-0b00-4e04-af4f-19010527cb93_>
<_a80e9c62-750a-4a6b-9548-d46677e806be_>
<ChannelInstanceGuid type="string">{23c9c636-93de-4aec-9bef-220766177a24}</ChannelInstanceGuid>
<Connection>
<AltPortName type="string">Dynamic Ethernet Switch Port</AltPortName>
<AltSwitchName type="string">Intel(R) I350 Gigabit Network Connection - Virtual Switch</AltSwitchName>
<AuthorizationScope type="string"></AuthorizationScope>
<ChimneyOffloadWeight type="integer">0</ChimneyOffloadWeight>
<Feature_C885BFD1-ABB7-418F-8163-9F379C9F7166>
<DisplayName type="string"></DisplayName>
<Flags type="integer">0</Flags>
<Setting_97274751-A1EC-4DC2-941D-B7F9A1AED814>
<Data type="bytes">AAIAAGQAAAAAAAAAAQAAAAAAAAA=
</Data>
<Version type="integer">256</Version>
</Setting_97274751-A1EC-4DC2-941D-B7F9A1AED814>
<Settings>
<Id type="string">97274751-A1EC-4DC2-941D-B7F9A1AED814</Id>
</Settings>
</Feature_C885BFD1-ABB7-418F-8163-9F379C9F7166>
<Features>
<Id type="string">C885BFD1-ABB7-418F-8163-9F379C9F7166</Id>
</Features>
<HostResources>
<HostResource type="string">8758EB1A-9687-41FC-9319-AE867D46BA5C</HostResource>
</HostResources>
<PoolId type="string"></PoolId>
<PreventIPSpoofing type="bool">False</PreventIPSpoofing>
<TestReplicaPoolId type="string"></TestReplicaPoolId>
<TestReplicaSwitchName type="string"></TestReplicaSwitchName>
</Connection>
<FriendlyName type="string">Network Adapter</FriendlyName>
<IsConnected type="bool">True</IsConnected>
<MacAddress type="string">00-15-5D-01-18-02</MacAddress>
<MacAddressIsStatic type="bool">False</MacAddressIsStatic>
<PortName type="string">E7F02418-A1EB-4FF9-84F8-BF461B2D00C6</PortName>
<SwitchName type="string">8758EB1A-9687-41FC-9319-AE867D46BA5C</SwitchName>
<VpciInstanceGuid type="string">{E9444985-111B-404A-82FE-48608A397676}</VpciInstanceGuid>
</_a80e9c62-750a-4a6b-9548-d46677e806be_>
<_ac6b8dc1-3257-4a70-b1b2-a9c9215659ad_>
<base_board>
<serial_number type="string">9595-3600-2199-6834-7686-3927-30</serial_number>
</base_board>
<bios_guid type="string">{B54BE7B5-05A4-4C4A-A2BD-D63272C7CCCD}</bios_guid>
<bios_serial_number type="string">9595-3600-2199-6834-7686-3927-30</bios_serial_number>
<boot>
<device0 type="string">Optical</device0>
<device1 type="string">HardDrive</device1>
<device2 type="string">Network</device2>
<device3 type="string">Floppy</device3>
</boot>
<chassis>
<asset_tag type="string">8437-8592-0329-9603-9215-1886-12</asset_tag>
<serial_number type="string">9595-3600-2199-6834-7686-3927-30</serial_number>
</chassis>
<num_lock type="bool">False</num_lock>
<version type="integer">2</version>
</_ac6b8dc1-3257-4a70-b1b2-a9c9215659ad_>
<_db8b9818-b4bb-4725-b99d-b4612716b6b4_>
<version type="integer">0</version>
</_db8b9818-b4bb-4725-b99d-b4612716b6b4_>
<global_settings>
<devices>
<allow_reduced_fc_redundancy type="bool">False</allow_reduced_fc_redundancy>
<generation_id type="string">883d11122d9b7b2c521be0c045ef3760</generation_id>
<storage_allow_full_scsi_command_set type="bool">False</storage_allow_full_scsi_command_set>
</devices>
<disk_merge_pending type="bool">False</disk_merge_pending>
<metrics>
<devicetype>
<deviceinstance>
<guid type="string">B637F346-6A0E-4DEC-AF52-BD70CB80A21D</guid>
<metric>
<enabled type="bool">False</enabled>
<lastcomputedtime type="integer">0</lastcomputedtime>
<peaktime type="integer">0</peaktime>
<poolid type="string"></poolid>
<resourcetypeid type="string">B637F347-6A0E-4DEC-AF52-BD70CB80A21D</resourcetypeid>
<starttime type="integer">0</starttime>
<typecode type="string">3F6F1051-C8FC-47EF-9821-C07240848748;0</typecode>
<value type="integer">0</value>
</metric>
</deviceinstance>
<guid type="string">B637F346-6A0E-4DEC-AF52-BD70CB80A21D</guid>
</devicetype>
<devicetype>
<deviceinstance>
<guid type="string">4764334D-E001-4176-82EE-5594EC9B530E</guid>
<metric>
<enabled type="bool">False</enabled>
<lastcomputedtime type="integer">0</lastcomputedtime>
<peaktime type="integer">0</peaktime>
<poolid type="string"></poolid>
<resourcetypeid type="string">4764334E-E001-4176-82EE-5594EC9B530E</resourcetypeid>
<starttime type="integer">0</starttime>
<typecode type="string">394DCE66-458F-4895-AE56-41D7C9602A49</typecode>
<value type="integer">0</value>
</metric>
<metric>
<enabled type="bool">False</enabled>
<lastcomputedtime type="integer">0</lastcomputedtime>
<peaktime type="integer">0</peaktime>
<poolid type="string"></poolid>
<resourcetypeid type="string">4764334E-E001-4176-82EE-5594EC9B530E</resourcetypeid>
<starttime type="integer">0</starttime>
<typecode type="string">FF85EA46-9933-4436-BE5D-C96827399966</typecode>
<value type="integer">0</value>
</metric>
<metric>
<enabled type="bool">False</enabled>
<lastcomputedtime type="integer">0</lastcomputedtime>
<peaktime type="integer">0</peaktime>
<poolid type="string"></poolid>
<resourcetypeid type="string">4764334E-E001-4176-82EE-5594EC9B530E</resourcetypeid>
<starttime type="integer">0</starttime>
<typecode type="string">04BDF59E-580D-4441-8828-FFFE44472D2D</typecode>
<value type="integer">0</value>
</metric>
</deviceinstance>
<guid type="string">4764334D-E001-4176-82EE-5594EC9B530E</guid>
</devicetype>
<devicetype>
<deviceinstance>
<guid type="string">83F8638B-8DCA-4152-9EDA-2CA8B33039B4</guid>
<metric>
<enabled type="bool">False</enabled>
<lastcomputedtime type="integer">0</lastcomputedtime>
<peaktime type="integer">0</peaktime>
<poolid type="string"></poolid>
<resourcetypeid type="string">70BB60D2-A9D3-46AA-B654-3DE53004B4F8</resourcetypeid>
<starttime type="integer">0</starttime>
<typecode type="string">AD29978B-AAB6-44AE-81CD-0609BF929F18;0\0\L</typecode>
<value type="integer">0</value>
</metric>
</deviceinstance>
<guid type="string">83F8638B-8DCA-4152-9EDA-2CA8B33039B4</guid>
</devicetype>
</metrics>
<owner>
<sid type="string">S-1-5-21-1940488291-1951097212-1584025624-1392</sid>
</owner>
<power>
<host_shutdown>
<action type="integer">1</action>
</host_shutdown>
<host_startup>
<action type="integer">1</action>
</host_startup>
</power>
<snapshots>
<list>
<size type="integer">0</size>
</list>
</snapshots>
<unexpected_termination>
<action type="integer">1</action>
</unexpected_termination>
<vhd_path_acled type="bool">True</vhd_path_acled>
</global_settings>
<manifest>
<size type="integer">11</size>
<vdev001>
<device type="string">58f75a6d-d949-4320-99e1-a2a2576d581c</device>
<flags type="integer">1</flags>
<instance type="string">58F75A6D-D949-4320-99E1-A2A2576D581C</instance>
<name type="string">Microsoft Synthetic Mouse</name>
</vdev001>
<vdev002>
<device type="string">197f74e3-b84b-46de-8ae6-82f1cd181cdc</device>
<flags type="integer">1</flags>
<instance type="string">197F74E3-B84B-46DE-8AE6-82F1CD181CDC</instance>
<name type="string">Microsoft Synthetic Keyboard</name>
</vdev002>
<vdev003>
<device type="string">f3cf6965-e8d3-44a9-9b7d-a04245ea7525</device>
<flags type="integer">1</flags>
<instance type="string">F3CF6965-E8D3-44A9-9B7D-A04245EA7525</instance>
<name type="string">Microsoft Synthetic Video</name>
</vdev003>
<vdev004>
<device type="string">84eaae65-2f2e-45f5-9bb5-0e857dc8eb47</device>
<flags type="integer">1</flags>
<instance type="string">84EAAE65-2F2E-45F5-9BB5-0E857DC8EB47</instance>
<name type="string">Microsoft Heartbeat Component</name>
</vdev004>
<vdev005>
<device type="string">2a34b1c2-fd73-4043-8a5b-dd2159bc743f</device>
<flags type="integer">1</flags>
<instance type="string">2A34B1C2-FD73-4043-8A5B-DD2159BC743F</instance>
<name type="string">Microsoft Key-Value Pair Exchange Component</name>
</vdev005>
<vdev006>
<device type="string">9f8233ac-be49-4c79-8ee3-e7e1985b2077</device>
<flags type="integer">1</flags>
<instance type="string">9F8233AC-BE49-4C79-8EE3-E7E1985B2077</instance>
<name type="string">Microsoft Shutdown Component</name>
</vdev006>
<vdev007>
<device type="string">2497f4de-e9fa-4204-80e4-4b75c46419c0</device>
<flags type="integer">1</flags>
<instance type="string">2497F4DE-E9FA-4204-80E4-4B75C46419C0</instance>
<name type="string">Microsoft Time Synchronization Component</name>
</vdev007>
<vdev008>
<device type="string">5ced1297-4598-4915-a5fc-ad21bb4d02a4</device>
<flags type="integer">1</flags>
<instance type="string">5CED1297-4598-4915-A5FC-AD21BB4D02A4</instance>
<name type="string">Microsoft VSS Component</name>
</vdev008>
<vdev009>
<device type="string">6c5addb9-a11a-4e8e-84cb-e6208201db63</device>
<flags type="integer">1</flags>
<instance type="string">6C5ADDB9-A11A-4E8E-84CB-E6208201DB63</instance>
<name type="string">Microsoft RDV Component</name>
</vdev009>
<vdev010>
<device type="string">2fc216b0-d2e2-4967-9b6d-b8a5c9ca2778</device>
<flags type="integer">1</flags>
<instance type="string">A80E9C62-750A-4A6B-9548-D46677E806BE</instance>
<name type="string">Synthetic Ethernet Port</name>
</vdev010>
<vdev011>
<device type="string">d422512d-2bf2-4752-809d-7b82b5fcb1b4</device>
<flags type="integer">1</flags>
<instance type="string">24984ED0-BDAD-4B90-82B2-5D59F874E91E</instance>
<name type="string">Synthetic SCSI Controller</name>
</vdev011>
<version type="integer">260</version>
</manifest>
<properties>
<global_id type="string">B37E54CD-FFBB-44DA-8B7C-322B922EAD72</global_id>
<highly_available type="bool">False</highly_available>
<last_powered_off_time type="integer">130493284127496105</last_powered_off_time>
<last_powered_on_time type="integer">130493284065876653</last_powered_on_time>
<last_state_change_time type="integer">130493284127496105</last_state_change_time>
<name type="string">LegacyTS</name>
<notes type="string"></notes>
<type_id type="string">Virtual Machines</type_id>
<version type="integer">1024</version>
</properties>
<settings>
<global>
<logical_id type="string">B37E54CD-FFBB-44DA-8B7C-322B922EAD72</logical_id>
</global>
<memory>
<bank>
<dynamic_memory_enabled type="bool">True</dynamic_memory_enabled>
<limit type="integer">1048576</limit>
<priority type="integer">5000</priority>
<reservation type="integer">512</reservation>
<size type="integer">4096</size>
<target_memory_buffer type="integer">20</target_memory_buffer>
</bank>
<vnuma>
<max_size_per_node type="integer">14770</max_size_per_node>
</vnuma>
</memory>
<processors>
<count type="integer">1</count>
<features>
<limit type="bool">False</limit>
</features>
<limit type="integer">100000</limit>
<limit_cpuid type="bool">False</limit_cpuid>
<reservation type="integer">0</reservation>
<vnuma>
<count_per_node>
<max type="integer">4</max>
</count_per_node>
<node_per_socket>
<max type="integer">1</max>
</node_per_socket>
</vnuma>
<weight type="integer">100</weight>
</processors>
<stopped_at_host_shutdown type="bool">False</stopped_at_host_shutdown>
<vnuma>
<enabled type="bool">False</enabled>
</vnuma>
</settings>
</configuration>
If its relevant, the host is not yet activated license wise. I downloaded the demo version so I could test my idea before making a purchase to go ahead with full implementation.
As it stands right now I'm not sure how to troubleshoot this. Many searches on google have not turned up any helpful info. Does anyone have any ideas?
Thanks,
DHi ,
First , please refer to the supported guest OS of windows 2012 hyper-v :
http://technet.microsoft.com/library/hh831531.aspx
2003/R2 should be with sp2 and max 2 virtual processors .
"'LegacyTS' was reset because an unrecoverable error occurred on a virtual processor that caused a triple fault."
If the issue is not due to the above items , you can try to check the "CPU compatibility " in that VM settings for troubleshooting:
Hope it helps
Best Regards
Elton Ji
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Setup for Controlling Articulations (or Patches) as an Interface
Hi,
Here is a new set-up I've created (though, I'm sure others have
done this or similar things before).
The objectives of this set-up are to provide a way to deal with
situations where I have limited processing power and limited
computer memory during the compositional process. This
set-up is not necessarily meant to be used to produce
professional, platinum recordings.
I am new to Logic Pro, so this set-up may have weaknesses and
flaws that I am not aware of; or, there may be a far better way
to achieve the ends than this.
The main concept I am using is that of an interface. An example
of an interface is a light switch on a wall; if you turn it on, the
light goes on, if you turn the switch down, the light goes off.
This is one type of light interface; another might be a chain
you pull; another might be a light dimmer switch.
In this set-up, a multi-instrument is used as an interface to Violins I.
I first began by setting up a new layer in the environment, and I called
it "Violins I Layer".
I then created a new multi-instrument, and labeled it "Violins I". It's icon
box is checked so that it shows up in the arrange menus.
All other objects to be created or used within this environment layer have
their icon checkbox unchecked.
To use Violins I in the arrange window, you simply select it. There is no
hint in the arrange window what the implementation of this Violins I section
is. It could be produced by an outboard sampler, or it could be produced
by Apple's JamPack orchestral Strings, or it could be produced by Garritan
Orchestral Strings (as a few examples). It could even be produced by
a flute patch, but this would simply be confusing to someone trying to
use the overall system.
Because there is no hint in the arrange window as to what actually
produces the Violins I sound, this is one reason I call it an interface.
You know that "Violins I" represents the first violin section, but you
do not know the details of the implementation.
In this example, there will be three implementations of the Violins I
section set up within the Violins I Layer within the Environment. The
three implementations use the following facilities: Garritan Orchestral
Strings (light patches, i.e., less memory patches), Apple's JamPack
Orchestra, and an outboard sampler-player called a Proteus/2.
We can call these three implementations each a "sub-instrumental-box" for
lack of a better name. That is, each implementation will have 16
MIDI channels, so it is like an outboard sampler-player as a stand-alone
box.
The environment will be configured so that only one of these three
sub-instrumental-boxes can play at a time. Thus, you either choose
the Garritan Orchestral Strings (GOS) implementation, the Apple
JamPack implementation, or the Proteus/2 implementation.
You will be able to change the implementation by adjusting a Cable
Switcher within the environment, or you will be able to send a MIDI
program change to the Cable Switcher, where a program change of 0
means the cable switcher sets itself to 0, a program change of 1
means the cable switcher sets itself to 1, and a program change of 2
means the cable switcher sets itself to 2.
If the Cable Switcher is valued at 0, GOS is used. If the Cable Switcher
is set at 1, Apple's Jampack Orchestra is used. If the Cable Switcher
is set to 2, the out-board, Proteus/2 is used.
Each sub-instrumental-box will have, potentially, up to 16 unique sounds.
Each unique sound will be accessed by what channel the input note is
playing on.
Thus, if an incoming note is on channel 1, it will be played arco (regardless
of whether the implementation is GOS, Apple, or Proteus/2).
If an incoming note is on channel 6, it will be played pizzicato (regardless
of whether the implementation is GOS, Apple, or Proteus/2).
Let it be assumed, that the Garritan Orchestral Strings (light) will use more memory
and more processing power than Apple JamPack. Whether it is a significant
difference I do not know. And, of course, the out-board, Proteus/2 uses the
most minimal of computer resources, because it generates its own sounds
externally (though these strings sounds are not very good when compared to
Apple and GOS).
So, the idea of this set-up, here exemplified only in the Violins I section, is that
while one is composing, and adding more instruments, sometimes the limitations
of your computer will require you to "downgrade" from Garritan Orchestral Strings
to Apple's JamPack strings, or even down to the out-board, Proteus/2.
For example, one might already have a sketch of the string section for a
passage, and now one is adding a trumpet; perhaps this trumpet uses
up the next bit of processing power such that the passage no longer
plays correctly. This, one hopes (as this set-up is brand new), could
be alleviated by taking the Violins I (and other string
sections), and switching them to play on the out-board Proteus/2. While the
Proteus/2 strings are poor, they still are strings, and they could play while one
focuses on the trumpet part.
Once I have given more details about this set-up, I will not then go into the
details of how you use the score editor. But, this set-up is meant to be used
with the Score Editor. Let me add these small points of detail about how
this set-up will interact with the Score Editor:
1. Within the score editor, you can select on or more notes, then click and
hold on the channel number in the left pane, and move the mouse up and
down to set all the notes to a given channel (assuming you also hold down
the option key if the initial channels for the notes is not the same).
Thus, you change the channel of the note or notes and their articulations
will automatically be changed from, say, arco to pizz.
2. Within the score editor, you can click in a region between two staves so
as not to select any notes or any staves, then set the default channel to
some value, such as 6, which represent pizz. Then when you enter a new
note using the pencil tool, that note will be associated with channel 6
and thus will be played pizz.
3. Within the arrange window, for a given track using the Violins I multi-
instrument, make sure that the Port is Off, the Channel is All, the Program
box is unchecked, and the Volumn box is unchecked.
In short, you can control the articulations of the notes without ever leaving
the score editor.
There is a down side, however. If you intend to have two, rhythmically
independent lines in one staff, and they are the same articulation (such
as arco, i.e., they are both MIDI channel 1 in this example), then you
will not be able to do so, because Apple has perhaps followed the "Village Idiot"
anti-pattern in some of its work on the Logic Pro application. That is,
this anti-pattern is exhibited when a new concept is introduced, but
instead of defining an interface for this new concept, either lack of funds,
time, or desire, results in the re-using of a previously defined interface
to carry out this new task.
Here is an example. I currently have a kitchen with a light and its
associated light switch. I hire a handyman to insert a disposal within
the sink. The handyman, being short of time, resources, and resolve,
hooks up the disposal to my light switch. Now, whenever I enter into
the kitchen and turn the light on using the light switch, the disposal
also turns on. Instead, the handyman, should have created a completely
independent interface to be used to turn the disposal on and off. Turning
the light on and off is a different concept from turning the disposal
on and off.
The use of the Village Idiot anti-pattern is potentially* used by Apple when it
says that a channel number is used to define one or more independent
lines within a staff. Instead, to avoid this anti-pattern, they would
come up with a new term, "score channel", "staff voice number", or
something, and build an interface specifically related to this functionality.
Then I could have one staff with two voices, each assigned a unique
"stave voice number", and each having an identical MIDI channel
number (because they are both playing arco).
*Note that I specifically say "potentially". I have not yet experimented
with placing two lines on one staff and then testing if I can get them
to play the same musical instrument. Keep in mind, please, that I am
new to Logic Pro. So, the above may be incorrect or incomplete.
My focus right now is to use Logic Pro while composing, and I am not
yet focusing on creating the best, professional looking score as an
end-product.
I've found one instance (though more may certainly exist) where
the village idiot anti-pattern is used. In the score editor, if I use a
user-defined rest (which, by the way, I always try to avoid using),
and then if I rubber-band select a section of the melody, if I try to
adjust the velocity of notes, I also inadvertently adjust the placement
of user-defined rests. The village idiot anti-pattern seen here is that
the exact same interface (moving the velocity value up and down) is
also used to mean the placement of user-defined rests; clearly, it is
best to create a new interface for dealing with the placement of
user-defined rests.
In summary, the possibility exists that in using the environment spelled
out here, the use of channels for articulations may pose problems for
you when you attempt to place two, rhythmically independent lines onto
one staff when these two lines use the same channel number to represent
their articulation (pizz. for instance). Rohan, and other Logic Pro experts
hopefully can confirm or rebut this warning of mine if it is false.
Within the environment's Violins I Layer, the Violins I multi-instrument has
already been created (the steps were given above).
In this example, I am using ten articulations:
Channel Number Articulation
1 SusV Lite (looped): Sustained vibrato.
2 SusNV Lite (looped): Sustained non-vibrato.
3 Grand Detache Lite
4 Marcato Lite
5 Sautille Lite
6 Pizz Lite
7 Tremolo Lite
8 Trills - Half Lite
9 Trills - Whole Lite
10 Stacatto
The articulation names are taken from the Lite versions of Garritan
Orchestral Strings. The Apple JamPack Violins I do not have all
these articulations. And, the Proteus/2 has even fewer. This, however,
will not end everything, for this means that if a sub-instrumental-box
does not have a Grand Detache, that we simply map Grand Detache
to what it does have, which is just a simple arco.
Thus, as less capable sub-instrumental-boxes are used, not only does
the sound quality degrade, but the articulations start to become less
detailed. Here is another example: Proteus/2 does not have a trill,
so its trill is mapped to a simple arco.
In the environment's Violins I layer, here are the details of the multi-
instrument called Violins I: It's icon is checked, its Port is off,
its Program is unchecked, its volume is unchecked.
Create a new cable switcher object using the menu:
New > Fader > Specials > Cable Switcher
Here are the details of this Cable Switcher (shown when you select it):
Output: Switch
Channel: 1
- 1 - : 48
Input: Program
Channel: 1
-1- : 7
Range: 0 127
Value as Number
Filter: Off
Feedback: unchecked box.
I don't know what all the above means, but I do know that it means at least
that the cable switcher will change value when it receives a program (or
patch) change on any MIDI channel (as described earlier): thus, if it
receives a program (or patch) change valued at 0, the cable switcher
will pass everything through the 0 output port.
Now draw a cable between the multi-instrument to the Cable Switcher.
The Cable Switcher is the gate-way to a particular implementation:
the specific sub-instrumental-box that is currently being used to create
the sounds.
Let's work on the first sub-instrumental-box: the Garritan Orchestral Strings.
Create a new Channel Splitter. Draw a cable from the Cable Switcher to
this newly created Channel Splitter.
The Channel Splitter can split an incoming MIDI signal into 16 MIDI channels
(based upon the MIDI channel of the note passing through). This is how
we will control the articulation.
Now, this next part is personal preference. You may have another working
method. But, we now need to connect the outputs of the Channel Splitter
to instruments. I have set up Logic Pro to automatically create 128 audio
instruments for me. For this sub-instrumental-box, I'll be using the ones
that Logic has named: "Inst 100", "Inst 101", ..., "Inst 109". I open up a new
environment window, and I select these ten instruments, and I drag them
to my current, Violins I Layer, and they are moved. I then close the
environment window I just, newly opened.
Back in the Violins I layer, I connect output channel 1 of the Channel Splitter
to Inst 100, and output channel 2 to Inst 101, and so forth, until I finally connect
output channel 10 to Inst 109.
For each of these ten instruments, I click under the "I/O" label, and bring up
the EXS24 sampler, and from there grab a specific Garritan Orchestral
Strings patch, such as "SusV Lite". Note that the specifics of how Logic Pro
converts the gigasampler format that GOS came in to a format Logic Pro
understands are not detailed here.
This completes the first sub-instrumental-box. (Other details not mentioned:
each instrument was sent to one bus to make mixing a little easier; but,
you can leave these set to outputs 1 and 2 if you wish).
If you send in MIDI notes on channel 1, they will sound as sustained, vibrato.
If you send in MIDI notes on channel 4, they will be marcato, and so forth.
Note, by the way, the "power" of being able to select a specific file having
the specific articulation I desire. Now I am in complete control as to how
this specific articulation will be played. But, if these articulations were
bundled within only one file, where I was forced to either send key-switches
or continuous controllers to activate either arco, marcato, termolo, and so forth,
then I would not have this kind of flexibility and power. By the way,
GOS lite sounds also have key-switched patches for those who like to
play the notes at the keyboard; but, in this instance, GOS also has flexibility
in that I am able to ignore the key-switched patches, and use the specific
files each containing a specific articulation. Apple also has a similar
flexibility: for Apple JamPack, you can use continuous controller 4 to
change articulations for some of the patches, or you have the choice
of loading each individual articulation from a specific file set (which is
what will be done in this example).
The next step is to create the second sub-instrumental-box implemented
by the Apple JamPack orchestra's Violins I sounds.
Create a new Channel Splitter. Cable the Cable Switcher (there is one free
node on it) to the new Channel Splitter. Apples Violins I have the following
articulations: Legato, Pizz, Tremolo, Trill Half, Trill Whole. For staccato,
we will load the Violins II staccato patch. By the way, I forgot to mention
that in the GOS, there is no staccato patch for Violins I, and I did a similar
thing, I loaded the Violins II staccato patch to be played by the Violins I.
Now I need some audio instruments to be connected from the Channel
Splitter. Open a new environment window. Drag over "Inst 110",
"Inst 111", ..., and finally "Inst 115".
Cable Channel Splitter 1 output to Inst 110. Set Inst 110 just under I/O to
Violins I Legato. Cable Channel Splitter 6 output to Inst 111 and just
under I/O set it to Violins I pizz. And so forth, using up a total of
6 channels to six instruments of Apple's JamPack strings.
Now, there are some output channels from the Channel Splitter that
are not used, because there is no corresponding patch in the
Apple JamPack. Simply map these to the closest match you can find.
Thus, output channel 2 of the Channel Splitter is patched to
Inst 110 which represents legato and is the closest representation
of "sustained, non-vibrato."
Also, output channel 3, Grand Detache, is linked in an identical fashion,
because plane legato is the closest match.
Output channel 4, which should represent marcato, is mapped to
Inst 112 (staccato), as that is a somewhat representative match-up.
And, you continue in this fashion, mapping the best you can. Remember,
Apple's JamPack does not have the many articulations of GOS lite
patches, it is a specific implementation of the interface. And, the
Apple JamPack will degrade in sound and in the number of unique
articulations, but, theoretically, use up less processing power from
the computer.
Note that you can now click on the Cable Switcher to toggle between
the two sub-instrumental-boxes we have just created. When the
Cable Switcher has "0" written on it, you hear GOS. When the
Cable Switcher has "1" written on it, you hear Apple JamPack.
And, when we are finally done with the steps to follow, when the
Cable Switcher has "2" written on it, you hear the out-board sampler
Proteus/2.
To create the third and final sub-instrumental-box, create a new
Channel Splitter. Cable the free node from the Cable Switcher to
this new Channel Splitter.
Create one new instrument (not a multi-instrument) and label it "Arco Violins".
Create another new instrument and label it "Marcato 2". Create another
new instrument and label it "Pizz Violins". Create a final instrument
and label is "Trem Strings". Obviously the Proteus/2 is not as sophisticated
as either Apple's JamPack or GOS in that there are not necessarily
specific Violin I patches only; so, I tried my best and used "Marcato 2"
for example, even though this is for the entire string family.
The details of each instrument is now given (remember, that some of these
details related specifically to the out-board sample-player, Proteus/2):
Arco Violins:
Port: Port A
Channel 1
Program: box checked - 7.
Volumn unchecked.
Pan unchecked.
Transpose 0.
Velocity 0.
Key Limit C-2 G8
Vel limit 0 127
Delay 0
No Transp. unchecked
No Reset: unchecked.
Style: auto
Marcato 2:
Port: Port A
Channel 4
Program: box checked - 9
Pizz Violins:
Port: Port A
Channel: 6
Program: box checked - 15
Trem Strings:
Port: Port A
Channel: 7
Program: box checked - 18
In the above listings, the Program has its box checked,
and the number which follows it is the specific patch or
sound containing the articulation I need to be produced
by the Proteus/2.
One can now click on the Cable Switcher and activate
one of the three, specific implementations of "Violins I".
You can also send in a program change through MIDI
to accomplish the same thing. However, it is always
possible that if you change the implementation in the
middle of a phrase, that the note off signal for the
last note played by the previous implementation might
be sent to the different, current implementation, with the
net result that the note never turns off.
Now that you have the Violins I layer in your environment,
here are some issues and some questions I'm thinking about (and don't know
the immediate answer to):
1. The GOS sub-instrumental-box used 10 EXS-24 audio-instruments, how
much memory was that exactly?
2. Apple's JamPack adds an additional 6 audio-instruments. How much
additional memory does adding JamPack produce?
3. If my G4 Macintosh has 1.5 gigs of memory, do I care? Is Apple's
Logic Pro program smart enough not to keep these sounds in memory
if they are not used? Or do these sounds always reside in memory?
4. To conserve memory, is it smarter to load Apple JamPack instruments
through the ESX-24?
Thanks,
Sys6
G4, 1.5 gigs of memory Mac OS X (10.4.8)wow! What a post!
Your way of "articulation switching" is very similar to the articulation tool I'm currently using, created by a member named kai. To find out more about his tool and its uses, visit the quick tip post I created: http://proapptips.com/tips/article.php?story=2006092810303559
edit: It turns out the link I provided in the tip has been changed, so if you want to download the tool and its manual, visit http://www.elvenmusic.com/vsl/vsl.html and scroll to the bottom.
Now, as for your concern of scoring two independently rhythmic parts with the same articulation in the score editor, there is a simple way around this problem. Simply add another track using the same Violin I instrument in the arrange page, which will give you 2 tracks in the score editor. This may not be the best scoring solution, as you will now have 2 violin staffs for divisi violin parts, but it will work fine while composing and you can merge the two when focusing only on the score.
Also, I'd like to point out a memory saving tip you will find helpful. First off, its impossible for you to apply your technique for every instrument of the orchestra, as logic limits you to 128 instruments at one time, and given that an full orchestra can easily use 30-40 instruments, you will not be able to load 32 articulations for each instrument (16 GPO instruments and 16 jampak instruments). Realistically you will only be able to load about 3-4 articulations for every instrument. However, logic does not have any limit for instrument OBJECTS, thus you can create "slots" where particular articulations may go, and turn the instrument to "off" and simply load each articulation as needed. Whats cool about this method, is that for the most important articulations that you always want on call, load them up in EXS first, and then turn off the object in the environment window. Now whenever you need that articulation, simply turn on the object to its proper instrument number and the associated instrument patch and EXS instrument will be loaded automatically! Cool huh! You can also open link your environment window to update its data to any other window using the "chain" icon. For example, you can have your arrange page open on on side of your monitor, and your environment window open on the other, and whenever you select violin one, the environment goes to your violin I object, allowing you to quickly add more articulations to your open slots when needed (I have mine on a 2nd monitor, which saves me from having to constantly open the environment when I want to add an articulation).
In answer to your other questions, if you are curious about how much memory your samples are using, run apple activity monitor before you load a sample, and after to get a rough estimate. Make sure to check how often the activity monitor checks ram, as its default may be 5min (dont remember), and keep in mind individual instruments are not that big, its when you load 20-30 that it starts to add up.
As for your 3rd question, logic will keep everything you load in its memory buffer and/or use CPU to keep it ready to go. Each exs you load, even if you dont select a patch, uses computer resources. Thus my recommendation of turning your objects to "off" and only loading articulations as needed.
I dont have apple jam packs, so I cant answer #4. However, you could test it yourself using activity monitor above.
Well done in your implementation of these concepts on your own! I personally had no clue any of this was possible before I stumbled upon Kai's articulation tool. Now that I have, composing with large sample libs as proven a much more enjoyable experience!
All the best, and thanks for sharing this with the logic community! -
Loop control for set number of times per loop
Hello everyone,
I am having a problem with an assignment, I have gotten it all to work except one thing. The assignment was to create a quiz asking for the planets in order by using JOptionPane input dialog,loop, and StringBuffer. If the user answers incorrect show a message dialog with a hint and ask the same question again. If the user gets it wrong again, then just move on to the next question. I got it to work except I cant figure out how to make it ask the question again only once if the answer is wrong. Here is what I have so far:
import javax.swing.*;
public class SolarSystemQuiz {
public static void main(String[] args) {
String answer;
int i ;
int count = 0;
int correct = 0;
int wrong = 0;
boolean crt;
for (i=1; i < 10; ++i) {
StringBuffer str = new StringBuffer("What is the " + getPlace(i) + " planet in the solar system?");
do {
answer = JOptionPane.showInputDialog(null, str);
crt = getAnswer(i, answer);
if (crt) {
++correct;
count = 0;
else{
++count;
++wrong;
} while ( ! crt && count <= 1);
JOptionPane.showMessageDialog(null, "You got " + correct +
" answers correct\n, and " + wrong + " incorrect answers.");
System.out.println(correct + wrong);
System.exit(0);
public static String getPlace(int spot) {
switch (spot) {
case 1:
return "1st";
case 2:
return "2nd";
case 3:
return "3rd";
case 4:
return "4th";
case 5:
return "5th";
case 6:
return "6th";
case 7:
return "7th";
case 8:
return "8th";
case 9:
return "9th";
default:
return "You have created an error, please try again.";
public static boolean getAnswer(int planet, String guess ) {
String mercury = "mercury" ;
String venus = "venus";
String earth = "earth";
String mars = "mars" ;
String jupiter = "jupiter";
String saturn = "saturn";
String uranus = "uranus";
String neptune = "neptune";
String pluto = "pluto" ;
switch (planet) {
case 1:
if (guess.equalsIgnoreCase("Mercury")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with M and has " + mercury.length() + " letters");
return false;
case 2:
if (guess.equalsIgnoreCase("Venus")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + venus.charAt(0) + " and has " + venus.length() + " letters");
return false;
case 3:
if (guess.equalsIgnoreCase("Earth")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + earth.charAt(0) + " and has " + earth.length() + " letters");
return false;
case 4:
if (guess.equalsIgnoreCase("Mars")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + mars.charAt(0) + " and has " + mars.length() + " letters");
return false;
case 5:
if (guess.equalsIgnoreCase("Jupiter")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + jupiter.charAt(0) + " and has " + jupiter.length() + " letters");
return false;
case 6:
if (guess.equalsIgnoreCase("Saturn")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + saturn.charAt(0) + " and has " + saturn.length() + " letters");
return false;
case 7:
if (guess.equalsIgnoreCase("Uranus")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + uranus.charAt(0) + " and has " + uranus.length() + " letters");
return false;
case 8:
if (guess.equalsIgnoreCase("Neptune")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + neptune.charAt(0) + " and has " + neptune.length() + " letters");
return false;
case 9:
if (guess.equalsIgnoreCase("Pluto")) {
JOptionPane.showMessageDialog(null, "Correct!");
return true;
else {
JOptionPane.showMessageDialog(null,
"not it, the planet starts with " + pluto.charAt(0) + " and has " + pluto.length() + " letters");
return false;
default:
JOptionPane.showMessageDialog(null, "Not in this universe, try again");
return false;
} Thanks for your time,
BradThis was a perfect example of how fast and easy a fix can be when the OP provides sufficient information and code.
Maybe you are looking for
-
Statistical WBS elements-Budgeting and Use
Hi Guys, Need some KT from you all regarding Statistical WBS Elements.My queries are 1.Can a statistical WBS element be budgeted? If yes how are the Budget distributed to those below. 2..If a level 2 WBS is marked statistical and it has 3 WBS under
-
Calling the selection screen of the calling program after the execution of
Hi all, I had created a program for a purchase order display. It has three radio-buttons from where i am calling different programs. I am using submit in the calling program and get parameter in at selection-screen output of the called program. I am
-
FM for Creating Price Calcualtion(VKP5)
Hi all, I want to A FM for Creating Price Calcualtion(VKP5) ... my scenario is to give validity date for pricing..... thnx Rohit
-
Hi, I cannot connect my IPad Air to Bluetooth particularly want access to my Panasonic SC-HTE 80 Speaker Board. Any advice would be welcome. Thanks
-
Apple TV settings won't change
I work at a book store and we have a current generation Apple TV connected to a Sony flat screen. We have a slide show on the Apple TV that we loop during store hours, but as of late the show is stopped after 2 minutes by a flower screen-saver. It