Subject: Re: struct dive_table dive_table and a wider view

Alex Deas alex at deeplife.co.uk
Thu Apr 18 03:26:02 PDT 2013


Hi All,

On the structure, would there be any interest from the UDDF/SubSurface community
in upgrading the dive log structures in a bigger way?

If I may introduce ourselves:  We developed a tool similar to Subsurface called
DiveLab, primarily for rebreather dive logs, rebreather data and military dive
computers/loggers (which sample very frequently compared to sports models).
  DiveLab runs under Windows only, and was developed in the Qt environment in
C++.  I can release a copy if anyone is interested with some example databases.
  We use it for analysing  huge quantities of rebreather dive data: one of our
rebreathers for commercial diving for example has 63 pieces of telemetry data
per waypoint, and waypoints are every 0.1s: some databases run to Gigabytes.
   All dive log data  within DiveLab is stored using SQL-Lite.   The DiveLab
tool is around 50 KLOC in total, of which 13 KLOC is SQL-Lite.

We have been watching the Subsurface project and UDDF from the sidelines, and
are proposing internally to move towards it by allocating some programming
effort to be involved with the development in areas that interest us, and in
particular to contribute some things that would extend UDDF to enable it to be
used for rebreather data, and then contribute by porting our SQL-Lite database
(or variant thereof) to the Subsurface project so Subsurface can handle really
big data sets much faster as well as provide professional analysis tools.    Our
objective is to use our development resource more effectively, so contributing
to a community project rather than continue maintaining our own tool.
 Subsurface has some things that are nicer than DiveLab, including prettier
printing, log summaries are better presented, and Subsurface is multi-platform:
the main advantage of Divelab is its ability to handle big datasets, and analyse
the data fast, in a comfortable manner.

As in all Open Source activities, we need to decide whether to create a
derivative work, or contribute to the main activity, and that depends a lot on
how your group view the additions and changes being proposed: if they are not
needed by the community, then a derivative work makes sense, or a midway point
is making an Add-on or Plug-in.   We have a short summary of our review of this
and what we intend to do, which I have put into
http://www.deeplife.co/BlueB_AdaSW_UDDF_Writer_130418.pdf and happy to take
comments.  Reference to Ada is simply the module that generates the dive log
within our rebreathers and dive computers are written in Ada.   I am getting the
confidentiality of the DiveLab documentation removed and so should be able to
issue that in the next couple of days: it gives a reasonable level of detail on
the implications of going down the SQL route.

Caveats: We have not been involved in Open Source previously, and operate a
rigorous software QA environment certified to IEC 61508 by SIRA, but the DiveLab
tool is not a safety critical application - we have used DiveLab for programmer
assessments, training etc, so it is carved out from much of that rigour other
than we have detailed written specs and documentation that tends not to be
needed/exist in Open Source environments.   Our process works by agreeing a
document on what we should do, then do that stage, verify it, document the
verification etc.

So any comments on what we are proposing to do with the UDDF parser to start
with, and then SQL-Lite, would be most welcome so we can get the objectives and
spec clear, than we are happy the work is defined, we can contribute a person or
two do those things.

With regards,

Alex

--
Alex Deas PhD, FIEE, C.Eng
Lead Technologist
Deep Life Ltd (IBC)
Skype: DeeplifeLtd
Web: www.deeplife.co

On 18 April 2013 at 08:59 subsurface-request at hohndel.org wrote:
> Send subsurface mailing list submissions to
> subsurface at hohndel.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
> or, via email, send a message with subject or body 'help' to
> subsurface-request at hohndel.org
>
> You can reach the person managing the list at
> subsurface-owner at hohndel.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of subsurface digest..."
>
>
> Today's Topics:
>
> 1. Re: struct dive_table dive_table (Amit Chaudhuri)
> 2. Re: struct dive_table dive_table (Linus Torvalds)
> 3. Re: struct dive_table dive_table (Linus Torvalds)
> 4. Re: struct dive_table dive_table (Amit Chaudhuri)
> 5. Re: struct dive_table dive_table (Lubomir I. Ivanov)
> 6. [PATCH 1/2] Delay Qt ui construction (amit.k.chaudhuri at gmail.com)
> 7. [PATCH 2/2] Use get_dive to populate divelistview with dives
> (amit.k.chaudhuri at gmail.com)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 17 Apr 2013 20:07:30 +0100
> From: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> To: Linus Torvalds <torvalds at linux-foundation.org>, Subsurface
> Mailing List <subsurface at hohndel.org>, "Lubomir I. Ivanov"
> <neolit123 at gmail.com>
> Subject: Re: struct dive_table dive_table
> Message-ID:
> <CAH=VbNe_d8cxb7v=wWKmV_U0G+h=2Yw-AttFT1bbAi_H3O721Q at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=15111
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://lists.hohndel.org/pipermail/subsurface/attachments/20130417/3bdee2f6/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 17 Apr 2013 12:22:11 -0700
> From: Linus Torvalds <torvalds at linux-foundation.org>
> To: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> Cc: Subsurface Mailing List <subsurface at hohndel.org>
> Subject: Re: struct dive_table dive_table
> Message-ID:
> <CA+55aFwopW52V-FuM0uA3NgvNHVPt42ma1ah8DnXzuWoVFmYTw at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Wed, Apr 17, 2013 at 12:07 PM, Amit Chaudhuri
> <amit.k.chaudhuri at gmail.com> wrote:
> > http://sourceware.org/bugzilla/show_bug.cgi?id=15111
>
> Interesting. With "-g" that test-case gives me your error. Without it, it
> works.
>
> Which gave me a clue.
>
> It seems to be the combination of C++ and -g that triggers it. It all
> worked for me on subsurface, because I was still on the master branch.
> When trying to compile the Qt branch, I see the same bug.
>
> Christ, I thought C++ development environments would be stable by now.
> Apparently they aren't.
>
> Linus
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 17 Apr 2013 12:49:26 -0700
> From: Linus Torvalds <torvalds at linux-foundation.org>
> To: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> Cc: Subsurface Mailing List <subsurface at hohndel.org>
> Subject: Re: struct dive_table dive_table
> Message-ID:
> <CA+55aFyCSrNteMLcLhVOaLM2tDj0S7naxegfFQZ6=pqVGf-W2A at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Wed, Apr 17, 2013 at 12:22 PM, Linus Torvalds
> <torvalds at linux-foundation.org> wrote:
> >
> > Christ, I thought C++ development environments would be stable by now.
> > Apparently they aren't.
>
> Actually, my bad. It's not the development tools, it's the f*cking
> language. It's broken.
>
> In C++, you can do
>
> struct x {
> ...
> };
>
> and it automatically makes a plain "x" by a type, without the
> "struct". So this is legal C++:
>
> struct x { int a; };
> x x;
>
> and declares the variable 'x' using the type 'x', because of this.
> Except it only does that if there isn't some other symbol of that name
> in scope, so it's kind of a "weak type" that randomly works or not
> depending on random other non-local things.
>
> Yeah, that's good language design. How are the C++ fanboys making
> excuses for *this* particular braindamage?
>
> So when gdb sees 'x', it now doesn't know if it's a type or a
> variable, because of this "enhancement" that C++ did to the namespace
> rules.
>
> This is exactly the kind of idiotic fundamental mistake that I so hate
> C++ for. A "better" typesystem/syntax that really isn't, and really
> subtly different semantics.
>
> It's still technically a gdb misfeature/bug, though. If gdb is
> supposed to debug C++, then it should damn well know about the
> ambiguities and know how to parse C++. But I can't personally blame
> gdb any more after having figured out where the bug comes from. I
> blame Bjarne Stroustrup.
>
> Linus
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 17 Apr 2013 21:59:16 +0100
> From: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> To: Linus Torvalds <torvalds at linux-foundation.org>
> Cc: Subsurface Mailing List <subsurface at hohndel.org>
> Subject: Re: struct dive_table dive_table
> Message-ID:
> <CAH=VbNe+w1RomuMVzONP0Tb0J+aRGv9Rx+AbrezRXxjWpunY0Q at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I'm kind of wondering what I've tripped over here ! How interesting is
> this?
>
> [Well, I think it is.....]
>
>
> On Wed, Apr 17, 2013 at 8:49 PM, Linus Torvalds <
> torvalds at linux-foundation.org> wrote:
>
> > On Wed, Apr 17, 2013 at 12:22 PM, Linus Torvalds
> > <torvalds at linux-foundation.org> wrote:
> > >
> > > Christ, I thought C++ development environments would be stable by now.
> > > Apparently they aren't.
> >
> > Actually, my bad. It's not the development tools, it's the f*cking
> > language. It's broken.
> >
> > In C++, you can do
> >
> > struct x {
> > ...
> > };
> >
> > and it automatically makes a plain "x" by a type, without the
> > "struct". So this is legal C++:
> >
> > struct x { int a; };
> > x x;
> >
> > and declares the variable 'x' using the type 'x', because of this.
> > Except it only does that if there isn't some other symbol of that name
> > in scope, so it's kind of a "weak type" that randomly works or not
> > depending on random other non-local things.
> >
> > Yeah, that's good language design. How are the C++ fanboys making
> > excuses for *this* particular braindamage?
> >
> > So when gdb sees 'x', it now doesn't know if it's a type or a
> > variable, because of this "enhancement" that C++ did to the namespace
> > rules.
> >
> > This is exactly the kind of idiotic fundamental mistake that I so hate
> > C++ for. A "better" typesystem/syntax that really isn't, and really
> > subtly different semantics.
> >
> > It's still technically a gdb misfeature/bug, though. If gdb is
> > supposed to debug C++, then it should damn well know about the
> > ambiguities and know how to parse C++. But I can't personally blame
> > gdb any more after having figured out where the bug comes from. I
> > blame Bjarne Stroustrup.
> >
> > Linus
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://lists.hohndel.org/pipermail/subsurface/attachments/20130417/b1ccd9ac/attachment-0001.html>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 18 Apr 2013 00:36:28 +0300
> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
> To: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> Cc: Subsurface Mailing List <subsurface at hohndel.org>
> Subject: Re: struct dive_table dive_table
> Message-ID:
> <CAGDbWi9GKk2iMUhrRah+neQQkC6jbkWMasvybQQLB2+WeH-m_w at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On 17 April 2013 23:59, Amit Chaudhuri <amit.k.chaudhuri at gmail.com> wrote:
> > I'm kind of wondering what I've tripped over here ! How interesting is this?
> >
>
> just try to set a breakpoint where the global is first used and obtain
> the address for a particular case. there is not need to use printf, i
> would think.
>
> if you are not comfortable with the GDB command line i would
> definitely recommend the tool "redhat insight", which is pretty much a
> GUI wrapper for GDB and it should work fine with C++ (unless there are
> more bugs). i've used that once explicitly to write an ARM version of
> a crazy x86 expression evaluator that writes its block execution to
> heap memory (which is AFAIK illegal on some popular mobile sandboxes)
> and then executes them in block segments, neglecting common FPU
> rounding and such. if it wasn't for that tool - i.e. viewing stack,
> heap and CPU/COP registers at the same time in multiple windows, i
> would probably have gone slightly more mad. so yes, the GUI approach
> is definitely a recommendation for more complicated application level
> debugging...
>
> lubomir
> --
>
>
> ------------------------------
>
> Message: 6
> Date: Thu, 18 Apr 2013 08:59:31 +0100
> From: amit.k.chaudhuri at gmail.com
> To: subsurface at hohndel.org
> Cc: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> Subject: [PATCH 1/2] Delay Qt ui construction
> Message-ID:
> <1366271972-5166-1-git-send-email-amit.k.chaudhuri at gmail.com>
>
> From: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
>
> The Qt ui will need to read the dive_table to populate widgets with
> dives. Gtk functionality in init_ui is required to parse the dives.
> Split init_ui to allow parsing to proceed and complete before Qt ui
> mainwindow constructor is called.
>
> Play with qDebug()'s printf style (Thiago!)
>
> Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> ---
> dive.h | 1 +
> divelist.c | 1 -
> main.c | 7 ++++---
> qt-gui.cpp | 13 ++++++++-----
> qt-ui/mainwindow.cpp | 4 ++++
> 5 files changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/dive.h b/dive.h
> index 734aa22..2662397 100644
> --- a/dive.h
> +++ b/dive.h
> @@ -602,6 +602,7 @@ extern void add_event(struct divecomputer *dc, int time,
> int type, int flags, in
> /* UI related protopypes */
>
> extern void init_ui(int *argcp, char ***argvp);
> +extern void init_qt_ui(int *argcp, char ***argvp);
>
> extern void run_ui(void);
> extern void exit_ui(void);
> diff --git a/divelist.c b/divelist.c
> index 61b9116..088b0e6 100644
> --- a/divelist.c
> +++ b/divelist.c
> @@ -492,7 +492,6 @@ void get_suit(struct dive *dive, char **str)
> /*
> * helper functions for dive_trip handling
> */
> -
> #ifdef DEBUG_TRIP
> void dump_trip_list(void)
> {
> diff --git a/main.c b/main.c
> index 3c0ea73..bf3bc08 100644
> --- a/main.c
> +++ b/main.c
> @@ -335,7 +335,7 @@ int main(int argc, char **argv)
> subsurface_command_line_init(&argc, &argv);
> parse_xml_init();
>
> - init_ui(&argc, &argv);
> + init_ui(&argc, &argv); /* the gtk stuff is needed for parsing below */
>
> for (i = 1; i < argc; i++) {
> const char *a = argv[i];
> @@ -372,12 +372,13 @@ int main(int argc, char **argv)
> report_dives(imported, FALSE);
> if (dive_table.nr == 0)
> show_dive_info(NULL);
> - run_ui();
> - exit_ui();
>
> parse_xml_exit();
> subsurface_command_line_exit(&argc, &argv);
>
> + init_qt_ui(&argc, &argv); /* qt bit delayed until dives are parsed */
> + run_ui();
> + exit_ui();
> #ifdef DEBUGFILE
> if (debugfile)
> fclose(debugfile);
> diff --git a/qt-gui.cpp b/qt-gui.cpp
> index 7454577..86731bb 100644
> --- a/qt-gui.cpp
> +++ b/qt-gui.cpp
> @@ -1864,6 +1864,14 @@ QStringList MainWindow::fileNameFilters() const
> }
> #endif /* NEEDS_TO_MOVE_TO_QT_UI */
>
> +void init_qt_ui(int *argcp, char ***argvp)
> +{
> + application = new QApplication(*argcp, *argvp);
> + application->installTranslator(new Translator(application));
> + MainWindow *window = new MainWindow();
> + window->show();
> +}
> +
> void init_ui(int *argcp, char ***argvp)
> {
> GtkWidget *win;
> @@ -1877,11 +1885,6 @@ void init_ui(int *argcp, char ***argvp)
> GtkSettings *settings;
> GtkUIManager *ui_manager;
>
> - application = new QApplication(*argcp, *argvp);
> - application->installTranslator(new Translator(application));
> - MainWindow *window = new MainWindow();
> - window->show();
> -
> gtk_init(argcp, argvp);
> settings = gtk_settings_get_default();
> gtk_settings_set_long_property(settings, "gtk-tooltip-timeout", 10,
> "subsurface setting");
> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
> index 577b7fb..e81d9de 100644
> --- a/qt-ui/mainwindow.cpp
> +++ b/qt-ui/mainwindow.cpp
> @@ -46,6 +46,10 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow())
> dive = new DiveItem(1,QString("01/03/13"),14.2,
> 29.0,QString("Wraysbury"),root);
>
> Q_UNUSED(dive)
> +
> + qDebug("dive_table checks - number of dives is %d", dive_table.nr);
> + qDebug("# allocated dives = %d, pre-existing = %d",
> + dive_table.allocated, dive_table.preexisting);
> }
>
>
> --
> 1.7.10.4
>
>
>
> ------------------------------
>
> Message: 7
> Date: Thu, 18 Apr 2013 08:59:32 +0100
> From: amit.k.chaudhuri at gmail.com
> To: subsurface at hohndel.org
> Cc: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> Subject: [PATCH 2/2] Use get_dive to populate divelistview with dives
> Message-ID:
> <1366271972-5166-2-git-send-email-amit.k.chaudhuri at gmail.com>
>
> From: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
>
> Add dives from dive_table to the model/view using the functions provided
> to extract the dives.
>
> We do not yet handle trips.
>
> Formatting of date/time, depth and duration need attention.
>
> Relies on earlier patch to delay Qt ui construction.
>
> We should look at the signals we publish to link to other widgets etc..
>
> Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> ---
> qt-ui/mainwindow.cpp | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
> index e81d9de..fb5def8 100644
> --- a/qt-ui/mainwindow.cpp
> +++ b/qt-ui/mainwindow.cpp
> @@ -10,6 +10,7 @@
> #include <QFileDialog>
> #include <QMessageBox>
> #include <QtDebug>
> +#include <QDateTime>
>
> #include "divelistview.h"
> #include "divetripmodel.h"
> @@ -31,28 +32,30 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow())
> if (model){
> ui->ListWidget->setModel(model);
> }
> - /* add in dives here.
> - * we need to root to parent all top level dives
> + /* we need root to parent all top level dives
> * trips need more work as it complicates parent/child stuff.
> *
> - * We show how to obtain the root and add a demo dive
> - *
> - * Todo: work through integration with current list of dives/trips
> * Todo: look at alignment/format of e.g. duration in view
> + *
> */
> DiveItem *dive = 0;
> DiveItem *root = model->itemForIndex(QModelIndex());
> if (root){
> - dive = new DiveItem(1,QString("01/03/13"),14.2,
> 29.0,QString("Wraysbury"),root);
> -
> Q_UNUSED(dive)
>
> - qDebug("dive_table checks - number of dives is %d", dive_table.nr);
> - qDebug("# allocated dives = %d, pre-existing = %d",
> - dive_table.allocated, dive_table.preexisting);
> + struct dive *d;
> + qDebug("address of dive_table %p", &dive_table);
> + int count = dive_table.nr;
> + for( int i = 0 ; i < count; ++i){
> + d = get_dive(i);
> + dive = new DiveItem(d->number,
> + QDateTime::fromTime_t(d->when).toString(),
> + (float)d->maxdepth.mm/1000 ,
> + (float)d->duration.seconds/60,
> + d->location,
> + root);
> + }
> }
> -
> -
> }
>
> void MainWindow::on_actionNew_triggered()
> --
> 1.7.10.4
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>
>
> ------------------------------
>
> End of subsurface Digest, Vol 17, Issue 67
> ******************************************


I
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130418/44738cbd/attachment-0001.html>


More information about the subsurface mailing list