How to get number of rows and columns in a two dimensional array ?
Hello,
What would be the simplest way to get number of rows and columns in a two dimensional array represented as integers ?
I'm looking for another solution as For...Each loop in case of large arrays.
Regards,
Petri
Hi Petri,
See a attached txt file for obtaining two arrays with upper and lower index values
Regards
Ray
Regards
Ray Farmer
Attachments:
Get2DArrayIndex.txt 2 KB
Similar Messages
-
How to determine rows and columns of a two dimensional array at runtime?
Dear All,
I am using Java 5.
I have defined an array as follows:
int[][] arr= { {1,2,3}, {4,5,6}};
Using the reference of arr, how can i get the rows (2) and columns (3) of this array at run-time?
Thanks in advance.
-Sameerrows and columns are simply the way you visualize the array.
int[][] arr= { {1,2,3}, {4,5,6}};
in above code
if you access array element as arr[x][y]
then x can have 0 or 1 where y can have 0,1 or 2
*/ -
How to get number of rows return in SELECT query
i'm very new in java, i have a question:
- How to get number of rows return in SELECT query?
(i use SQL Server 2000 Driver for JDBC and everything are done, i only want to know problems above)
Thanks.make the result set scroll insensitve, do rs.last(), get the row num, and call rs.beforeFirst(), then you can process the result set like you currently do.
String sql = "select * from testing";
PreparedStatement ps =
con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = ps.executeQuery();
rs.last();
System.out.println("Row count = " + rs.getRow());
rs.beforeFirst();~Tim
NOTE: Ugly, but does the trick. -
Setting number of rows and columns
How do I set the number of rows and columns of a table, say 2348 rows by 3 columns?
Then how do I quickly select the last row?
Also, if I enter a formula in row 1 column 2, how do I quickly copy that formula down to row 1435, or to the end of the column? Dragging seems slow and awkward.I wish to add a few words to Jerrold responce.
gjf12 wrote:
How do I set the number of rows and columns of a table, say 2348 rows by 3 columns?
Then how do I quickly select the last row?
Also, if I enter a formula in row 1 column 2, how do I quickly copy that formula down to row 1435, or to the end of the column? Dragging seems slow and awkward.
The process that you describe is inefficient.
The efficient one is :
create a table
enter the formulas in a single row
delete the rows below.
Now, each newly inserted row will contain the formulas.
From my point of view, it's when this is done that it will be interesting to apply a script adding rows.
Here is a script inserting rows.
--[SCRIPT insertRows]
Enregistrer le script en tant que Script : insertRows.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Sélectionner une cellule au-dessous de laquelle vous voulez insérer des lignes.
menu Scripts > Numbers > insertRows
Le script vous demande le nombre de lignes désiré puit insère celles-ci.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
--=====
Save the script as a Script: insertRows.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Select a cell below which you want to insert rows.
menu Scripts > Numbers > insertRows
The script ask you the number of rows to insert then it does the required insertion.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
Save this script as a … Script in the "Folder Actions Scripts" folder
<startupVolume>:Library:Scripts:Folder Action Scripts:
--=====
Yvan KOENIG (VALLAURIS, France)
2010/01/13
--=====
on run
set defaultValue to 100
if my parleAnglais() then
set myInteger to my askAnumber("Insert how many rows ?", defaultValue, "i")
else
set myInteger to my askAnumber("Combien de lignes voulez-vous insérer ?", defaultValue, "i")
end if
set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
repeat myInteger times
add row below row rowNum2
end repeat
end tell
end run
--=====
on getSelParams()
local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
if r_Name is missing value then
if my parleAnglais() then
error "No selected cells"
else
error "Il n'y a pas de cellule sélectionnée !"
end if
end if
set two_Names to my decoupe(r_Name, ":")
set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
if item 2 of two_Names = item 1 of two_Names then
set {row_Num2, col_Num2} to {row_Num1, col_Num1}
else
set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
end if
return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
end getSelParams
--=====
set {rowNumber, columnNumber} to my decipher(cellRef,docName,sheetName,tableName)
apply to named row or named column !
on decipher(n, d, s, t)
tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
end decipher
--=====
set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
tell application "Numbers" to tell document 1
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
try
(selection range of table y) as text
on error errMsg number errNum
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
return {theDoc, theSheet, theTable, theRange}
end try
end repeat -- y
end if -- x>0
end tell -- sheet
end repeat -- i
end tell -- document
return {missing value, missing value, missing value, missing value}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
Asks for an entry and checks that it is an floating number
set myInteger to my askAnumber(Prompt, DefaultValue, "i")
set myFloating to my askAnumber(Prompt, DefaultValue, "f")
on askAnumber(lPrompt, lDefault, ForI)
local lPrompt, lDefault, n
tell application (path to frontmost application as string)
if ForI is "f" then
set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
try
set n to n as number (* try to convert the value as an number *)
return n
on error
if my parleAnglais() then
display alert "The value needs to be a floating number." & return & "Please try again."
else
display alert "La valeur saisie doit être un nombre décimal." & return & "Veuillez recommencer."
end if
end try
else
set n to text returned of (display dialog lPrompt default answer lDefault as text)
try
set n to n as integer (* try to convert the value as an integer *)
return n
on error
if my parleAnglais() then
display alert "The value needs to be an integer." & return & "Please try again."
else
display alert "La valeur saisie doit être un nombre entier." & return & "Veuillez recommencer."
end if
end try -- 1st attempt
end if -- ForI…
end tell -- application
Here if the first entry was not of the wanted class
second attempt *)
tell application (path to frontmost application as string)
if ForI is "f" then
set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
try
set n to n as number (* try to convert the value as an number *)
return n
on error
end try
else
set n to text returned of (display dialog lPrompt default answer lDefault as text)
try
set n to n as integer (* try to convert the value as an integer *)
return n
on error
end try -- 1st attempt
end if -- ForI…
end tell -- application
if my parleAnglais() then
error "The value you entered was not numerical !" & return & "Goodbye !"
else
error "La valeur saisie n’est pas numérique !" & return & "Au revoir !"
end if
end askAnumber
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) mercredi 13 janvier 2010 12:43:34 -
Maximum number of rows and columns in data form
Hi,
I wanted to know if there is a limitation to the number of rows and columns that can be displayed in a data form, in Hyperion planning 11.1.2.1 ?
And what would be the most appropriate number of rows and columns to be included for optimum performance.
Thanks.Hi,
While its a fun fact to determine how much one can stuff into a web form, the reality is: how much can a user reasonably consume in a web form?
And what would be the most appropriate number of rows and columns to be included for optimum performance
You will find that the answer to this is by "what design makes a web form most usable?" And no, the users don't really know what they want from a design perspective, they see it in their head, but usually what they ask for is something that would look entirely different (huge).
The next thing to think about is the use of member selection functions in the page axis. IDescendants(Entity) in a dropdown could cause issues just as easily as too many rows - and again make the drop down unusable for a user.
If your question is a bit more technical, then consider this (somewhat oversimplified): Web forms are constructed by a process on the server. Objects are created based on the form's definition and used by the process that builds the form. The process uses Cartesian looping (lots of iterations) to construct the form cell by cell, starting at the top left and finishing up in the bottom right. If the form has a million cells on it, then the loop and all the code within it runs a million times. The capability of the server has a lot to do with how well it can handle this request, and how many it can handle at one time.
The result of this is gobs of HTML and JavaScript. All of this has to be sent over a network to the requesting client. The client starts receiving the web page code and has to render it in the browser and run the JavaScript. The ability to do this is limited by the browser, the OS, and the hardware that the client is running on.
And that's just rendering the page for use.
Now it has to be interacted with on the client machine, and changes parsed, packaged, and sent back to the server.
So the technical answer is, there can be many limitations to how many rows and columns a data form can have - none of which can truly be anticipated by anyone. This is why I put the part about usability first in this post.
Regards,
Robb Salzmann -
How to display number of rows as columns in a select statement? This is on
How to display number of rows as columns in a select statement? This is on 10g R2.
Thanks,
RFor the current (ie. row 1 of 100)
row_number over (order by -pick_a_column_set) as rnfor the total number of columns returned in your query
count(*) over() as total_count -
How do I delete multiple rows and columns in an image?
I am looking into how digital SLRs extract video data from a CMOS sensor. To give an example, the GH1 from Panasonic can record video at 1920 x 1080 from a 12 MPixel sensor that, say, is 4000 horizontal x 3000 vertical. How they do that seems to be not in the public domain, but there have been a few guesses (see http://www.dvxuser.com/V6/showthread.php?t=206797 and http://luminous-landscape.com/forum/index.php?showtopic=38713).
One approach would be to simply read every second row of sensor pixels (1500 rows read from the original 3000) and once you have those in memory, delete every second column (2000 columns left). You would end up with a 2000 x 1500 image which could then be resampled to 1920 x 1080.
I'd like to simulate what the camera appears to be doing, by generating a 4000 x 3000 test image and then asking Photoshop CS4 to delete the appropriate rows and columns. It may not necessarily be every second row; the Canon 5DMk11 appears to read every third row, so I may need to delete two out of every three rows.
Can Photoshop do that sort of thing? If so, how?Thanks for the suggestions. Yes, I did take a detailed look at your images, but they weren't 100% convincing because it wasn't clear just what was happening. And Adobe's explanation, after reading it again, explains nothing at all to someone who doesn't know how Nearest Neighbor works.
But you are correct -- Nearest Neighbor does effectively delete pixels. I proved it with the attached 6 x 6 image of coloured pixels (the tiny midget image right after this full stop -- you'll have to go to maximum zoom in PS to see it).
These are the steps to delete every second row and then every second column.
1. Select Image > Image Size.
2. Set Pixel Dimensions > Height to half the original (in this case set to 3 pixels).
3. Set Resample Image to Nearest Neighbor.
4. Click OK and the image shoould now consist of three vertical white strips and three vertical Green-Red-Blue stripes.
5. Repeat steps 1-4, but this time set Pixel Dimensions > Width to half the original (in this case set to 3 pixels). The image should now consist of three horizontal stripes Green-Red-Blue.
Just to make sure the method worked for every third pixel, I repeated the above steps but with 2 pixels instead of 3 and obtained the correct White-Green, White-Green pattern.
I resampled the Height and Width separately for the test so that I could see what was happening. In a real example, the height and width can be changed at the same time in the one step, achieving the same results as above.
Finally, how to explain how Nearest Neighbor works in the simple cases described above?
Division by 2
In the case of an exact division by two (pixels numbered from top leftmost pixel), only the even numbered rows and columns remain. To put it a different way, every odd numbered row and column are deleted.
Division by 3
Only rows and columns 2, 5, 8, 11... remain.
Division by N
Only rows and columns 2, 2+N, 2+2N, 2+3N... remain.
To put it simply, a resample using Nearest Neighbor (using an exact integer multiple) keeps every Nth row and column, starting from number two. The rest are deleted. -
How to create table with rows and columns in the layout mode?
One of my friends advised me to develop my whole site on the
layout mode as its better than the standard as he says
but I couldnot make an ordinary table with rows and columns
in th layout mode
is there any one who can tell me how to?
thanx alotYour friend is obviously not a reliable source of HTML
information.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Mr.Ghost" <[email protected]> wrote in
message
news:f060vi$npp$[email protected]..
> One of my friends advised me to develop my whole site on
the layout mode
> as its
> better than the standard as he says
> but I couldnot make an ordinary table with rows and
columns in th layout
> mode
> is there any one who can tell me how to?
> thanx alot
> -
How can we export graphs row and column wise in pdf
Hi Experts,
can some body tell, i have graphs in rows and columnswise in output(means side by side) after export to pdf graphs shows in rows only not like in output. but i need graphs rows and columns wise in pdf. how can i achive my requirement.please let me know steps.
regards,
krisHi Kris,
This is a limitation with Export to PDF. Plz. go thru' below link.
Re: WAD Application export to PDF
--Priya -
Web Form :Number of rows and columns
Hi All,
I have a web form with many rows and columns . Is it possible for a user to view only a limited rows in the form ? Not using Adhoc/Analyze option . since there are formula rows which wont appear in Analyze grid.
The user want to see only 5 to 10 random rows in the form ? How to do this ?
Please help.I remember an option in 11.1 which allows users to dynamically add rows and I cannot find that in 11.1.2.2
I think the user will have to always update the user variable to what he want to see.
Regards
Celvin
http://www.orahyplabs.com
http://docs.oracle.com/cd/E17236_01/epm.1112/planning_admin_11122300/frameset.htm?launch.html -
How to set the Selected row and Column in JTable
Hi,
i have a problem like the JTable having one Method getSelectedRow() and getSelectedColumn to know the Selected row and Column but if i want to explicitly set the Selected Row and Column,then there is no such type of Methods.If anybody has any solution then i will be thankful to him/her.
Praveen K SaxenaIs that what you're looking for? :myTable.getSelectionModel().setSelectionInterval(row, row);
myTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column); -
How to make a particular row and column field editable in ALV
Hi Experts,
I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
Kindly help me out to solve this.
Any help would be appreciated.
Thanks,
AshutoshHi Ashutosh,
please check below, explained by some experts.
In the below link editing two columns MOD_RANK and TECH_RANK.
These two columns will be in edit mode once after selecting the required record
Editing single cell in a row of ALV table
And also look for more info
http://scn.sap.com/thread/884976 -
Setup for discoverer table for showing number of Rows and columns of Report
As oracle discoverer report show "Rows 1-25 of"(Total rows) and "Column 1-6 Of"(Total Column).
This total rows and columns information's is not appearing on our reports.
Kindly let us know its setting/setups .
This is very urgent to us, Any help will be highly appreciated.
Thanks, AvaneeshHmm, what version of Discoverer are you on? Do I understand you correctly that you are able to run a Discoverer report and see this rows and columns information? What software are you running when you do this - Viewer, Plus, or Desktop? Where is this showing up - the top of the report maybe? Or maybe the bottom of the report? The only thing I can think of to handle this is the Page Setup for a workbook, and looking at the Header and Footer sections of that setup. But I am on Discoverer 10.1.2.2 and I don't see anything I can insert on the header/footer that would show this kind of information. Desktop will let you do Page x of y pages (Plus does not), but that is not what you are seeing. You can maybe look at the page setup and see if there is something there not documented in the Discoverer guides.
John Dickey -
Hi!
Can someone tell me how to obtain the number of rows returned by a query?
I tried to use getFetchSize() but it seems to always return 0 for my query.
THANKS in advance!
ResultSet testRS = Stmt.executeQuery(testStmt);
int size = testRS.getFetchSize();
System.out.println("size = " + size);
Wo LayTo get the number of rows returned, you have to loop
through the result set, or do a "select count" (which
is more efficient since it doesn't have to pass the
rows across the network) ...Looping around the entire result set is not very performance efficient. Then agin if you use count (*) you actually execute an extra query.
The best thing you can do is:// assume res is your result set.
res.last();
int rows = res.getRow();This way you only have to execute one query and you don't really need to loop around the entire result set. Of course you will have to have a scrollable result set, if this is supported by your DB.
Hope that helped.
afotoglidis -
How to get number of rows in tableview
Hello,
Could anybody help me on how to get the number of rows in a tableview? Sort of using DESCRIBE TABLE in classic ABAP.
Thanks,
RickyThere is an attribute of the class CL_HTMLB_TABLEVIEW named
ROWCOUNT.
Inside an event u need to get this info use this code:
Replace 'Monitor' for the ID of your tableview
DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW,
r_count type i,
tv ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'tableView'
id = 'Monitor' ).
IF tv IS NOT INITIAL.
DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
tv_data = tv->data.
r_count = tv_data->rowcount.
ENDIF.
Maybe you are looking for
-
Slim, a problem with virtual consoles and a question about reboot
hi, just installed slim but now when I switch to the virtual consoles my session on X starts firing keyboard events on the consoles I have there, how can I fix that? I'm using xmonad, my terminal is sakura and I'm starting slim from /etc/inittab and
-
Will not boot after moving Journal
I did this on a test system so the fact that it didn't work isn't so big of a deal, but I'd like to get it working. I ran through the steps outlined in Apple's own KB as well as the article on AFP548 to move the journal of my boot volume to the ssd i
-
Hi all, I like to migrate custom attributes from test environment to my production environment. I read OIM documentation and i tried to fallow these steps but I cannot export sandbox and import it because all sandboxes are published in the test envir
-
I have an IPAD 2 and need a flash player equivalent/3rd party app to install on my IPAD?
-
I know you mostly hear of problems on forums but here's my experience so far. Time Capsule took 13 hours to back up 118 GB. Wire it directly! Don't use wifi for the first backup. After that it has worked like a dream. Hourly backups are only a few mi