How to print out the position of 2 dimension arrays?
there are 2 dimension arrays, how can print out the position of value than 4?
for example
0 2 3 2 2 2
0 1 1 2 5 3
1 2 3 3 2 1
print out:
The pos is ( 5,2).
Hello
If I understand your question correctly, you are trying to print out the indexes where the value in your matrix is greater than 4
If this is the case, then what you need to use is nested for loops e.g.
for (int i = 0; i< array[0].length; i++)
for (int j = 0; j< array[].length; j++)
int value = array[i][j];
if (value > 4)
System.out.println("The pos is (" + i + "," + j + ")" );
Regarding the syntax I have used to get the size of the array, I am not sure if this is correct, but you should have an idea of what I am doing.
Sajid
Similar Messages
-
How to find out the position in which an application hangs
Hi,
is there any possibility to find out the position in a source, in which a deployed application hangs?
For example, there is an endless loop in an application, which is already deployed. In runtime the application hangs in this loop. How can I findout in which line the application hangs?
In other words, how can I see the stack of a certain process,for example, http_workerx?
Regards,
Ali
Message was edited by:
Ali Maraschi-SchouschtariHi Ali,
With <b>SAP NetWeaver Composition Environment (CE) 7.1 SP3</b> it is very easy.
<i>1.) Open the SAP Management Console
2.) Go to AS Java Threads tree node - you will see all the threads that are currently started on the system
3.) Check for threads that are colored in red - it takes about 30 sec the system to detect that an HTTP thread (http_workerx), as it is in your case, is hanging/executing endless loop.
4.) Right click on the hanging thread (colored in red) and pick 'Callstack' from the pop-up menu
5.) In the new window you will see the stack-trace showing what exactly this hanging thread is doing at the moment.</i>
With the <b>previous versions (or SPs)</b> you need to apply a little bit more technical skills for the same result. <i>(1) you need to do produce thread dump of the server that is suspected to have hanging thread</i> and (<i>2) to analyze this thread dump (check what the threads in Running state are doing).</i> As it is in your case with the HTTP worker threads, their names are also printed in the thread dump, so you can focus only on them. -
How to print out the text for Info record in ME23?
Dear all,
I need to print out a report of PO data. need to print out the text from Info record note (like the picture shown below) in ME23, how should I pull that field and display out?
I need the solution urgently. Hope experts can help.
Thank you very much.
[http://img293.imageshack.us/img293/238/inforecordnd1.png]Please check below sample code:
PARAMETERS: p_ebeln TYPE ebeln OBLIGATORY.
TYPES: BEGIN OF ty_ekpo,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
END OF ty_ekpo.
DATA: i_ekpo TYPE TABLE OF ty_ekpo,
wa_ekpo TYPE ty_ekpo.
DATA: l_name TYPE tdobname,
i_tline TYPE TABLE OF tline,
wa_tline TYPE tline.
CONSTANTS: c_id TYPE tdid VALUE 'F02',
c_object TYPE tdobject VALUE 'EKPO'.
AT SELECTION-SCREEN.
SELECT SINGLE ebeln INTO p_ebeln
FROM ekko
WHERE ebeln = p_ebeln.
IF sy-subrc NE 0.
MESSAGE e001(00) WITH 'Enter valid PO Number'.
ENDIF.
START-OF-SELECTION.
SELECT ebeln ebelp INTO TABLE i_ekpo
FROM ekpo
WHERE ebeln = p_ebeln.
LOOP AT i_ekpo INTO wa_ekpo.
CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp
INTO l_name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = c_id
language = sy-langu
name = l_name
object = c_object
TABLES
lines = i_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc EQ 0.
LOOP AT i_tline INTO wa_tline.
WRITE:/ wa_tline-tdline.
" Format wa_tline-tdline in the way you need to print out
ENDLOOP.
ENDIF.
ENDLOOP.
Regards
Eswar -
How to print out the data from the file ?
hi all,
i have upload my file to here :
[http://www.freefilehosting.net/ft-v052010-05-09 ]
anyone can help me to print out the data from the file ?
the content of the file should be like this :
185.56.83.89 156.110.16.1 17 53037 53 72 1
and for the seven column is
srcIP dstIP prot srcPort dstPort octets packetshi all,
i have try to do this
public static void Readbinary() throws Exception
String file = "D:\\05-09.190501+0800";
DataInputStream dis = new DataInputStream(new FileInputStream(file));
//but then how to read the content ??????can you give me more hint ?????
i have find the netflow v5 structure by C
struct NFHeaderV5{
uint16_t version; // flow-export version number
uint16_t count; // number of flow entries
uint32_t sysUptime;
uint32_t unix_secs;
uint32_t unix_nsecs;
uint32_t flow_sequence; // sequence number
uint8_t engine_type; // no VIP = 0, VIP2 = 1
uint8_t engine_id; // VIP2 slot number
uint16_t reserved; // reserved1,2
struct NFV5{
ipv4addr_t srcaddr; // source IP address
ipv4addr_t dstaddr; // destination IP address
ipv4addr_t nexthop; // next hop router's IP address
uint16_t input; // input interface index
uint16_t output; // output interface index
uint32_t pkts; // packets sent in duration
uint32_t bytes; // octets sent in duration
uint32_t first; // SysUptime at start of flow
uint32_t last; // and of last packet of flow
uint16_t srcport; // TCP/UDP source port number or equivalent
uint16_t dstport; // TCP/UDP destination port number or equivalent
uint8_t pad;
uint8_t tcp_flags; // bitwise OR of all TCP flags in flow; 0x10
// for non-TCP flows
uint8_t prot; // IP protocol, e.g., 6=TCP, 17=UDP, ...
uint8_t tos; // IP Type-of-Service
uint16_t src_as; // originating AS of source address
uint16_t dst_as; // originating AS of destination address
uint8_t src_mask; // source address prefix mask bits
uint8_t dst_mask; // destination address prefix mask bits
uint16_t reserved;
but how to translate the structure to java,then get the data from the file ?
Edited by: 903893 on Dec 21, 2011 10:52 PM -
How to print out the informations of mp3 for the format of TagContent?
I can get the mp3 title, but when i try to print it out, it is the wrong code...
i know the format of title is TagContent .
But how to print such " TagContent " format by system.out.print?
Here's my code :
import de.vdheide.mp3.*;
import java.io.*;
public class c
public static void main (String [] args) throws IOException
try
MP3File mp3 = new MP3File("fly.mp3");
System.out.println( mp3.getTitle());
catch (Exception e)
}Hello
If I understand your question correctly, you are trying to print out the indexes where the value in your matrix is greater than 4
If this is the case, then what you need to use is nested for loops e.g.
for (int i = 0; i< array[0].length; i++)
for (int j = 0; j< array[].length; j++)
int value = array[i][j];
if (value > 4)
System.out.println("The pos is (" + i + "," + j + ")" );
Regarding the syntax I have used to get the size of the array, I am not sure if this is correct, but you should have an idea of what I am doing.
Sajid -
How to print out the exception caught in the servlet controller to JSP?
May I know how to print the Exception caught and the stacktrace thing? What i try to do this in the databaseErrata.jsp code was not given me any answer. Instead, causing a number of errors.
Below are my servlet controller code and databaseErrata.jsp code.
----$CATALINA_HOME/webapps/mvct/WEB-INF/classes/Action.java----
import java.io.*;
import java.sql.*;
import java.text.*;
import javax.naming.*;
import javax.servlet.*;
import javax.servlet.http.*;
import foo.*;
public class Action extends HttpServlet
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
response.setContentType("text/html");
PrintWriter out = response.getWriter();
// find real web resource
String forward = request.getServletPath();
//'forward' is a string variable consist of url
if(forward.endsWith(".do"))
forward = forward.substring(1, forward.length()
-3) + ".jsp";
else
throw new ServletException(
"Action servlet called with illegal path: " +
forward); //display the defined error msg and error
url within the 'forward'
out.println("forward after forward.substring() = " +
forward + "</br>");
// build and validate view page attributes
HttpSession session = request.getSession();
try
byEmployeeId convert =
(byEmployeeId)session.getAttribute("convert");
if(convert == null)
session.setAttribute("convert", convert = new
byEmployeeId());
convert.start("11145");
catch(NamingException ex)
request.setAttribute("exception", ex);
forward = "databaseError.jsp";
catch(SQLException ex)
request.setAttribute("exception", ex);
forward = "databaseErrata.jsp";
catch(IllegalArgumentException ex)
request.setAttribute("message", "<FONT COLOR='red'>"+ex.getMessage()+"</font>");
// forward request
RequestDispatcher rd =
request.getRequestDispatcher(forward);
rd.forward(request,response);
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
doGet(request, response);
}----$CATALINA_HOME/webapps/mvct/databaseErrata.jsp----
<% String message = (String)request.getAttribute("message"); %>
<HTML>
<HEAD>
<TITLE>databaseErrata.jsp Page</TITLE>
</HEAD>
<BODY>
<% if (message != null) { %>
Message = <%= message %>
<H1>databaseErrata.jsp Page</H1>
</BODY>
</HTML>You're missing a closing curly bracket in the JSP page.
Also, this will only print the exception message. I would recommend passing on the whole Exception object.
ie request.setAttribute("theException", ex);
That way you have the exception object to print the stacktrace from.
However, you are doing this manually. The container can handle this stuff for you if you so wish.
Check the documentation on error pages. You are able to set up an error page in the web.xml, that all exceptions/errors get directed to.
something like:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/errorPages/debugError.jsp</location>
</error-page>
You then write the JSP page something like this
<%@ page language="java" %>
<%@ page isErrorPage="true" %>
<%@ page import="java.util.*, java.io.*" %>
<h1>Programming error <BR> FOR DEBUGGING PURPOSES ONLY</h1>
<p>This page is only for debugging purposes. Should not be deployed to live environment.</p>
<p>Details of the error are as follows:</p>
<table border = 1 width=200>
<tr><td valign=top><strong>Error :</strong></td><td><%=exception.getMessage()%></td></tr>
<tr><td valign=top width='80%'><strong>Trace :</strong></td><td><pre><% exception.printStackTrace(new PrintWriter(out));%></pre></td></tr>
</table>
<br>Cheers,
evnafets -
How to print out the Forms and Table fields relationship, data mapping?
I create a forms and tables relationship inside the Form Developer 11g, once I created the Data relationships between the form data field and the Table column name. I don't have any command to print it out, such as Layout Wizard.
Are there any programs on Windows platform can print it out?hi all,
i have try to do this
public static void Readbinary() throws Exception
String file = "D:\\05-09.190501+0800";
DataInputStream dis = new DataInputStream(new FileInputStream(file));
//but then how to read the content ??????can you give me more hint ?????
i have find the netflow v5 structure by C
struct NFHeaderV5{
uint16_t version; // flow-export version number
uint16_t count; // number of flow entries
uint32_t sysUptime;
uint32_t unix_secs;
uint32_t unix_nsecs;
uint32_t flow_sequence; // sequence number
uint8_t engine_type; // no VIP = 0, VIP2 = 1
uint8_t engine_id; // VIP2 slot number
uint16_t reserved; // reserved1,2
struct NFV5{
ipv4addr_t srcaddr; // source IP address
ipv4addr_t dstaddr; // destination IP address
ipv4addr_t nexthop; // next hop router's IP address
uint16_t input; // input interface index
uint16_t output; // output interface index
uint32_t pkts; // packets sent in duration
uint32_t bytes; // octets sent in duration
uint32_t first; // SysUptime at start of flow
uint32_t last; // and of last packet of flow
uint16_t srcport; // TCP/UDP source port number or equivalent
uint16_t dstport; // TCP/UDP destination port number or equivalent
uint8_t pad;
uint8_t tcp_flags; // bitwise OR of all TCP flags in flow; 0x10
// for non-TCP flows
uint8_t prot; // IP protocol, e.g., 6=TCP, 17=UDP, ...
uint8_t tos; // IP Type-of-Service
uint16_t src_as; // originating AS of source address
uint16_t dst_as; // originating AS of destination address
uint8_t src_mask; // source address prefix mask bits
uint8_t dst_mask; // destination address prefix mask bits
uint16_t reserved;
but how to translate the structure to java,then get the data from the file ?
Edited by: 903893 on Dec 21, 2011 10:52 PM -
Hi all,
i want printout of the RFQ.
What i have to do for that?
thanksOutput of RFQ
1. Condition Table
SPRO > Material Management> Purchasing -> Message -> Output Control->Condition Tables->Define Condition Table for RFQ
Select:
Purchasing Doc. Type,
Purch. Organization,
Vendor
2. Access Sequences
SPRO -> Material Management-> Purchasing -> Message -> Output Control->Access Sequences->Define Condition Table for RFQ
3. Message Type
SPRO -> Material Management-> Purchasing -> Message -> Output Control->Message Types->Define Message Type for RFQ
*4. Message Determination Schemas*
4.1. Message Determination Schemas
SPRO -> Material Management-> Purchasing -> Message -> Output Control->Message Schema->Define Message Schema for RFQ-> Maintain Message Determination Schema
4.2. Assign Schema to RFQ
SPRO -> Material Management-> Purchasing -> Message -> Output Control->Message Schema->Define Message Schema for RFQ-> Assign Schema to RFQ
5. Partner Roles per Message Type
SPRO -> Material Management-> Purchasing -> Message -> Output Control-> Partner Roles per Message Type ->Define Partner Role for RFQ
6. Condition Record
Navigation Path: SAP Menu-> Logistics -> Material Management -> Purchasing-> Master data->Messages-> RFQ-> MN01-> Create
Now you create RFQ (ME41) and save it. Go to ME9A and print the RFQ by giving output type. -
How to find out the maximum value of one array
hi all..
I have one array that consists of some elements
so I want the maximum value of the list ...
if anyone knows this please help me..
thanks..>
If your array is already sorted, you can do a binary
search.
I think there are already methods to do that in
java.util.Arrays. (?)
If not, it's not hard to find an example on the net.
A binary search will be more efficient.1. If your array is already sorted, you do not need a binary search. Either check the value of arr[0] or arr[arr.length - 1] depending on the direction of sorting.
2. If your array is not sorted, try this:
int maxValue = arr[0];
for(int index = 1; index < arr.length; index++)
if(arr[index] > maxValue)
maxValue = arr[index];
} -
How do I print out the value returned by a method in main??
I'm a total newbie at java, I want to know how I can print out the value returned by this function in the "Main" part of my class:
public int getTotalPrice(int price)
int totalprice=price+(price*0.08);
return totalprice;
I just want to know how to print out the value for total price under "public static void main(String[] args)". thanks in advance,
BradFew ways you could do it, one way would be to create an instance of the class and call the method:
public class Test
public double getTotalPrice(int price)
double totalprice = price + (price * 0.08);
return totalprice;
public static void main(String[] args)
Test t = new Test();
System.out.println(t.getTotalPrice(52));
}Or another would be to make getTotalPrice() static and you could call it directly from main. -
How to print out answers using the form I created
I created an application form for my company. People have submitted their applications, but I do not know how to print them out.
Is there a way to copy the answers into the form and print that? Or something like that?
I cannot just print the answers because it's over 100 pages and would be disorganized.
I basically just need to know how to print out the form I created with the respondants answers.
ThanksHere is what you can do...
Open the form file
Go to the View Responses tab
Select the View menu in the upper right corner of the UI
Select the Details View menu item on that menu
The Details View pane will open on the right side of the window
At the bottom of that pane there is a set of buttons
The first button let's you print the detail view of the currently selected response
The last button labeled Export will create a PDF file of the selected response
Is that what you were trying to accomplish? I'll admit that we need to make print and export to PDF more discoverable and easier to get to - that was too many steps
Randy -
Can we print out the XY GRAPH?
I 'D like to print out my XY GRAPH results. I know how to print out the xy-plot picture result. but xy-plot picture is not good at differentiating too many curves. (one curve is ok), xy graph is more powerful at differentiating more curves, but i just don't know how to print out the xy-graph only( not the whole vi front panel).
Hi,
Recently I've answered on the question how to save image of the graph into the file. See
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=137&HOID=5065000000050000001501010...
If you want to print image you can do the following things:
1.Save image into the temporary file with above described technique.
2.Create "standard" report using "Function->Report Generation->New Report.vi"
3.Append image file to report using "Function->Report Generation->Append Image toreport.vi"
4.Print report using "Function->Report G
eneration->Print report.vi"
5.Close report using "Function->Report Generation->Dispose report.vi"
6. And delete temporary file.
Actually this is just an idea. I haven't test it yet, but I think this will work.
The example is attached.
Good luck.
Oleg Chutko.
Attachments:
Print.vi 54 KB -
Can't figure out how to print on the right side of a greeting card using a 5X7 when folded
I have a HP Officejet Pro 8500A. I am trying to print a greeting card, but cannot figure out how to print on the right side of the paper so that it's on the correct side when folded. The paper is 5X7 when folded, 10X7 laid flat.
shgilljx,
Welcome to the forums. I will try to explain this in simple terms, and you'll have to play with it. We'll use plain paper, cut to 10x7. You'll need a marker, 4-5 sheets of paper.
Lay paper flat, number top 1, bottom 2. Flip paper over right to left. number top 3, and bottom 4.Draw a line where the fold would be on each page.1) Put paper with number 3 side up in printer.
To create both templates using MW Office, do this. The requires 2 documents. One is graphic, one is text.
Text template: The text will be printed on number 2. That means your wording must be within the bottom half of the page.
Graphic template: The image must be rotated 180 degrees.The image must be within the top half of the page.
Print the text template. Insert side #3 into the printer. The text should print on side #2.
Print the graphic template: Insert side #1 into the printer. The graphic should print on side #3.
When folded, all should be correct, if I did it right.
I am a volunteer. I am not an HP employee.
To say THANK YOU, press the "thumbs up symbol" to render a KUDO. Please click Accept as Solution, if your problem is solved. You can render both Solution and KUDO.
The Law of Effect states that positive reinforcement increases the probability of a behavior being repeated. (B.F.Skinner). You toss me KUDO and/or Solution, and I perform better.
(2) HP DV7t i7 3160QM 2.3Ghz 8GB
HP m9200t E8400,Win7 Pro 32 bit. 4GB RAM, ASUS 550Ti 2GB, Rosewill 630W. 1T HD SATA 3Gb/s
Custom Asus P8P67, I7-2600k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX660 2GB, 750W OCZ, 1T HD SATA 6Gb/s
Custom Asus P8Z77, I7-3770k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX670 2GB, 750W OCZ, 1T HD SATA 6Gb/s
Both Customs use Rosewill Blackhawk case.
Printer -- HP OfficeJet Pro 8600 Plus -
How can i print out the waveform chart?
hello everybody,
how can i print out the "waveform chart". can i do it just push the button. ( example; stop button is stop the program etc..)
i checked the NI examples but i can't understand. i'm new to the Labview.
pls help me.
i added the my program
look forward your reply
regards from turkey...
Message Edited by hknmkt on 05-29-2008 04:15 AM
Attachments:
29.05.2008_11.vi 37 KBhi jim,
i tried the program but it's not running. When i run the program, it's print out without run the program
i added the printed file.
look forward your reply
hakan
Attachments:
error8.JPG 8 KB -
I am trying to print a PDF file to a legal size paper and I would like for it to fill up the page. How do I do this? I went into the settings and changed it from letter to legal, but it's still printing out the same size. Can someone help me, please?
Are you trying to Print to PDF or are you trying to Print a PDF file to a physical printer?
Maybe you are looking for
-
No HD to Select.. Cannot Find a related topic.
Hi, i have a macbook pro g5 intel 2.5g duo. Have leopard 10.5.7 and had a pc formatted HD plugged in and it was pulled out and since the apple logo screen with the spinning circle is all i see. So i restart the computer with the osX DVD selected lang
-
Problem in exporting Datas to Adope
Hi Experts, I have not install SAP Interactive forms.I want to generate some reports in Adope.How can i achieve this.I came to know it is possible through XML and XSL but i need a procedural guidance how to generate . Regards, Ramanan.P
-
My start up disk Macintosh HD is full on my McAir OSX 10.9.4 memory 4GB. I need to clear the disk so that I can update it with the new software IOS 10.9.5 requiring 2.05GB. Need guidance on how to clear space.
-
How to make iMac run less hot when in Bootcamp?
When I play a game in win7 trough bootcamp, my iMac gets real hot. How to make it run cooler? It sounds like fans could be running faster; but I want it to do it automaticly.
-
I have changed agent assignment property for one task and assigned it as a general task on Production. Do i need to activate the workflow after this?