Displaying a ragged array

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I'm in the process of creating a desktop application to display and edit  
data that's best treated as a ragged array of Strings: it is quite  
unlikely that all rows in the array will be the same length.

I've built and debugged a Datastore class to hold it as an ArrayList of  
ArrayList<String>  - the ArrayList<String> being in a wrapper class  
representing a row of fields. The DataStore allows rows, columns and  
individual fields to be inserted, deleted, and the fields to be modified.

Datastore extends AbstractTableModel because I was initially intending to  
use a JTable to display and manipulate its contents, but now its  
successfully manipulating the ragged array I'm having twinges of doubt  
about how whether a JTable can is the best way of displaying it and  
allowing it to be viewed and modified, i.e. can a JTable deal  
successfully with the missing elements at the end of rows in a ragged  
array?

Would I be better off with a custom built structure containing, say, an  
array of JButtons to display fields in the ragged array and that can be  
clicked to add a field, edit or delete it?

I'll be very interested to hear how you've handled, or would handle, this  
display problem.


--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: Displaying a ragged array
On 2018-09-16, Martin Gregorie wrote:
Quoted text here. Click to load it

You do not specify the language in which you're writing. Is it unique to
the RPi?

Re: Displaying a ragged array
On 09/16/2018 02:54 PM, Roger Bell_West wrote:
Quoted text here. Click to load it

With all the "J"s in the original post, I'd guess either JavaScript or Java.


--  
+----------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC                      |
We've slightly trimmed the long signature. Click to see the full one.
Re: Displaying a ragged array
On 16/09/2018 21:19, Gerald Lester wrote:
Quoted text here. Click to load it
Surprisingly he's not using GEORGEIII macros or 6809 assembler! ;-)

Re: Displaying a ragged array
On Sun, 16 Sep 2018 21:27:13 +0100, mm0fmf wrote:

Apologies for that: it was meant for comp.lang.java.programmer


--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: Displaying a ragged array
Quoted text here. Click to load it




    I could possibly help if it were PAL-III.

--  
Ivan Reid, School of Engineering & Design, _____________  CMS Collaboration,
Brunel University.    Ivan.Reid@[brunel.ac.uk|cern.ch]    Room 40-1-B12, CERN
We've slightly trimmed the long signature. Click to see the full one.
Re: Displaying a ragged array
On 16/09/18 19:17, Martin Gregorie wrote:
Quoted text here. Click to load it

XML/XLST to a web browser.

--  
Adrian C

Re: Displaying a ragged array
On Wed, 19 Sep 2018 14:02:13 +0100, Adrian Caspersz wrote:

Quoted text here. Click to load it

...and modifying it? Saving the result?


--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: Displaying a ragged array
On 19/09/18 14:55, Martin Gregorie wrote:
Quoted text here. Click to load it

web app, client side javascript (jquery, handlebars etc...)

https://en.wikipedia.org/wiki/Ajax_ (programming)

or good old CGI html forms processing (POST/GET etc...)

or a NodeJS server....

--  
Adrian C

Re: Displaying a ragged array
On Thu, 20 Sep 2018 17:23:21 +0100, Adrian Caspersz wrote:

Quoted text here. Click to load it

Why would I ever build a web app or use that typeless mess called  
javascript when what I need is a standalone application, preferably  
written in Java (or C with curses or GTK2 at a pinch) that reads, alters  
and saves local files?
  

--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: Displaying a ragged array
On Thu, 20 Sep 2018 17:56:54 +0000 (UTC)

Quoted text here. Click to load it

    Fashion ? Foolishness ?

Quoted text here. Click to load it

    Ah because you want to practice separation of function and
interface, so you'll write the backend in C, middleware in Java and a web
front end in PHP and JavaScript and feel thoroughly miser^Wmodern.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Displaying a ragged array
On Thu, 20 Sep 2018 21:53:39 +0100, Ahem A Rivet's Shot wrote:

Quoted text here. Click to load it
Since I can get all the interface separation I need by using an MVC  
structured program written in Java, thats what I'm about to do.
  
Quoted text here. Click to load it
Yep, somebody who 'codes' by copying snippets from slashdot and calling  
somebody else's JS fragments from github etc. may well do that. I'll give  
it a miss, thanks.


--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: Displaying a ragged array
On Thu, 20 Sep 2018 20:52:23 +0000 (UTC)

Quoted text here. Click to load it

    It is also a common 'enterprise' style, sometimes it even makes
sense (usually when scalability is a dominant issue, inefficiency is
trumped by being able to throw more hardware at the job without thinking).

    Thoroughly unsuited for most purpose of course.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Displaying a ragged array
On 21/09/18 16:45, Ahem A Rivet's Shot wrote:
Quoted text here. Click to load it
Ah. The new Barclay's 'Smart Investor' website described exactly!

Only idiots would use it apart from people who were already part of it  
before it was 'improved' with pastel shades of happy sheeple investing  
in rap investments...


--  
The theory of Communism may be summed up in one sentence: Abolish all  
private property.

We've slightly trimmed the long signature. Click to see the full one.
Re: Displaying a ragged array
Ahem A Rivet's Shot wrote:

Quoted text here. Click to load it

<https://imgur.com/gallery/vqUQ5

Re: Displaying a ragged array

Quoted text here. Click to load it

Thanks, I guess.  I wasted a pleasant half hour going to that site
and following the links.  The BOFH lives on!

--  
/~\   snipped-for-privacy@kltpzyxm.invalid (Charlie Gibbs)
\ /  I'm really at ac.dekanfrus if you read it the right way.
We've slightly trimmed the long signature. Click to see the full one.
Re: Displaying a ragged array
On Fri, 21 Sep 2018 19:35:29 +0100

Quoted text here. Click to load it

Excellent, thanks for that.  :-)


Re: Displaying a ragged array
On Fri, 21 Sep 2018 16:45:03 +0100, Ahem A Rivet's Shot wrote:

Quoted text here. Click to load it
.... and would have got anybody using it helped through the door with a
     hobnailed boot in all places but one [1] where I've worked.

[1] The Naval Dockyard Project, Bath, 1975 - the project was three years  

creative use of the TMMITFM staffing method [2].

By the time I was involved, the MOD management had been shoved to one  
side and replaced by ICL Datakill guys, who were actually pretty good,  
and the programming duffers had also been removed and replaced by around  
80 contractors, of whom I was one. Most were quite good, but there were  
2-3 shockers:

- one was well known to a bunch of the others who said they'd never seen  
him to finish a program: he worked a lot of overtime, pocketed the cash  
and left just before his mess was due to be system tested.

- another didn't know that in COBOL one paragraph falls through to the  
next unless a GOTO says otherwise. Consequently, all his code looked like  
this:
   PARA-1.
     STATEMENT.....
     ........
     GO TO PARA-2.
   PARA-2.
     STATEMENT.....
     ........
     GO TO PARA-3.
   PARA-3.
     ...

- a third never did understand that a 'divide by zero' error would be
  caught by an ON SIZE ERROR exception. He thought it should cause the  
  mainframe to screech to a halt and require a reboot.

Anyway, we got the system redesigned, up and running in 18 months, and  
even had fun doing it. Bath is a nice,lively town and it was a happy,  
well lubricated project that worked surprisingly well considering the  
speed with which the team had been assembled. It turned out to be a good  
social mix of remaining MOD HEOs, contractors and the Datakill crew  
management.

[2] TMMITFM stands for the 'Those Magnificent Men In Their Flying  
Machines' film and its "There is nothing a German Officer Cannot Do"  
scenes as the German military flew across the Channel while reading their  
how-to-fly manual. In this project it became implemented as "There is  
nothing a Civil Servant Cannot Do". The MOD bosses staffed the project by  
sending a bunch of HEOs on a systems course. When they got back they were  
told to design the system, a complex one that was supposed to manage all  
aspects of purchasing, stock control and tracking as naval equipment and  
stores were bought, moved round between the four naval dockyards, and  
eventually used up or scrapped. Two or three months later they sent  
another bunch of HEOs on a COBOL course. When they got back the analysts  
were told "Here are your programmers: give them some programs to write"  
and the whole catastrophe started to crumble.


--  
Martin    | martin at
Gregorie  | gregorie dot org

Re: Displaying a ragged array
On Fri, 21 Sep 2018 20:18:09 +0000 (UTC)

Quoted text here. Click to load it

    When it makes sense it is usually the only way to get the job done,
because you've sailed off the deep end in requirements either way past where
you can fit the job on a single machine or because you need to push
availability past the point where a country getting disconnected causes you
problems so you have to have wide area distribution, local storage with
global failover (see things like Amazon's Dynamo for the extreme end of this
trend - one of the few that is publicly documented, the architecture of
the Yahoo! customer database is interesting but that's all I'm willing to
say about it).

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Displaying a ragged array
On Thu, 20 Sep 2018 17:56:54 +0000, Martin Gregorie wrote:

Quoted text here. Click to load it

when you want multiple people to be able to access & manipulate data on a  
central server & you don't want then tied to particular hardware or  
software

a well conceived web app would be accessible from any device including an  
old WAP mobile phone with minimal disruption to the user experience.

this is not the correct model for every app


--  
Wasn't there something about a PASCAL programmer knowing the value of
everything and the Wirth of nothing?

Site Timeline