if-statement

include a JSP file in another with cases

[亡魂溺海] 提交于 2020-01-17 02:58:27
问题 How can i include a JSP page in another JSP with the IF structure: Can i use this part of code in a JSP file: <% UtilisateurAction useraction = new UtilisateurAction(); String statut = useraction.Connect(); //System.out.println(statut); if(statut=="ADMIN"){ %> <%@ include file="menu.jsp"%> <%} else {if(statut=="USER"){%> <%@ include file="menu.jsp"%> <%}} %> 回答1: If all you want is the possibility to use <c:if> you must have a scoped variable. Attributes of current request, session of

How to count in nested if statement in matlab?

放肆的年华 提交于 2020-01-17 01:40:14
问题 I want to increment the count and display the value in a message box. I'm using a nested if statement. This is my code if sum( abs( f1(:) - f2(:))) == 0.0 i = i + 1; elseif sum(abs(f2(:) - f3(:))) == 0.0 i = i+ 1; elseif sum(abs(f3(:) - f4(:))) == 0.0 i = i + 1; else i = 1; end h = msgbox('Perfect = %d',i); Here f1 , f2 , f3 , and f4 contains the difference between two images in float. I have declared i = 0; before if statement. Still I'm not able to see the message box in the output. I tried

Logic to reading an XML file in vb.net

荒凉一梦 提交于 2020-01-17 01:27:07
问题 I have an XML file that i am trying to read and rewrite (for later manipulation) to a new text file using vb.net. I am able to read the XML successfully and print it out, but i am having problems getting the correct with then start and end tags of each element/attribute. I am using an 'xmlNodeReader' to read the document by getting the name and value of each read. Then a select case with xmlNodeType.Element or xmlNodeType.EndElement How do I get the correct logic to solve this, as some XML

TypeError: 'float' object cannot be interpreted as an integer

不问归期 提交于 2020-01-16 15:44:22
问题 Why is the object being interpreted as a int and not a float. main2 = True while main2: try: amount = float(input('annual gross income: ')) namount = float(amount) expenses = float(input('annual expenses: ')) nnexpenses = float(expenses) if(9226 <= namount <= 37450): print('Your tax rate is $922.50 + 15%') print(float(round(namount - namount*0.15 - 922.50 - nnexpenses))) if(namount <= 9225): print('Your tax rate is 10%') print(float(round(namount - namount*0.10 - nnexpenses,2))) if(37451 <=

Windows Form Doesn't Show C# Timer

送分小仙女□ 提交于 2020-01-16 15:35:34
问题 Code: while ( int_Timer > 0 ) { int int_Ticks = 0; if ( int_Ticks < 100) { int_Ticks++; } if (int_Ticks == 100) { int_Timer--; lbl_Timer.Text = int_Timer.ToString(); } } So I basically tried to make a timer however, since I implemented this code the form doesn't appear in the taskbar. In fact the only indication is the Visual Studio Debug running. 回答1: Go into the Windows Forms toolbox. Under "Component", find "Timer". Drag/drop one onto your form. It won't show up where you dropped it (it's

Resolve aggregate and Non-aggregate mix error for IF results in Tableau

半城伤御伤魂 提交于 2020-01-16 05:15:30
问题 I am trying to do the following in Tableau. If the chosen key figure is sales or volume (non-aggregate fields) then call calculation1 else calculation 2. IF ATTR([Choose Key Figure])= "Sales" THEN [Periodic Calculation] ELSEIF ATTR([Choose Key Figure])= "Volume" THEN [Periodic Calculation] ELSEIF ATTR([Choose Key Figure])="profit" THEN [Periodic Calculation 2] ELSEIF ATTR([Choose Key Figure])="price per unit" THEN [Periodic Calculation 2] END But I am getting the following error: "Cannot mix

How to get second argument of Round() to work with columns?

馋奶兔 提交于 2020-01-16 04:13:10
问题 I've a simple table with an integer column: # setup table: create table t(x int); insert t select 1; The query select round(1.234, 1) from t returns 1.2 as expected. However, select round(1.234, x) from t returns 1.2000 . (It should return 1.2 , as per the docs.) Is this a bug? (Tested on version 5.5.10 and latest 5.6.24.) Or, is there any particular technical reason why columns cannot be used in the second argument of round ? How can we get round to work even while there are columns used in

Need help putting the else into the while with a counter

家住魔仙堡 提交于 2020-01-16 03:32:05
问题 password = str() while password != "changeme": password = input("Password: ") print("Thou Shall Pass Into Mordor") else print("Thou Shall Not Pass Into Mordor") Could I please have some helo with my code. I want it to print "Though Shall Not Pass Into Mordor" when the password is incorrect 5 times. Can someone please help me! Can someone also please put a counter in? 回答1: Use break to end a loop, and use for with a range() : for attempt in range(5): password = input("Password: ") if password

If data present, replace with data from another column based on row ID

牧云@^-^@ 提交于 2020-01-16 02:04:09
问题 I would like to replace data in columns rep1 to rep4. The data in these columns match unique ID's in the first column. I want to replace the data in columns rep1-rep4 with data in the value column with the corresponding ID row. So, for the second row "b", I want to replace "a" in the column "rep1" with the corresponding value in row "a", in this case, -400. ID rep1 rep2 rep3 rep4 value a -400 b a -300 c a b -200 d a b c -300 e a b c d -400 f -400 g f -400 h -400 i -200 j k l -300 k l -200 l

yacc - How to do a if condition

你离开我真会死。 提交于 2020-01-16 02:04:06
问题 I am trying to do a simple if condition from an input file. i will have something like if(color = black) No matter what i do i keep getting 1 shift / reduce I am very new to lex and yacc Do YACC grammars often have shift-reduce conflicts? and should i not worry about them? My lex file will return every character in the file correctly so i wont show you the lex file However, here is my yacc file: %{ #include <ctype.h> #include <stdio.h> %} |IF LPAREN COLOR EQ BLACK RPAREN {$$ = $1; printf(