comp.lang.ada
 help / color / mirror / Atom feed
* Newbie Needs Ada Advice
@ 2007-05-03 17:13 ezkcdude
  2007-05-03 18:24 ` Dmitry A. Kazakov
                   ` (4 more replies)
  0 siblings, 5 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-03 17:13 UTC (permalink / raw)


I'm interested in using Ada, so I installed the GNAT compiler on
Windows (tried on Mac, but I had problems with X11). Anyway, I want to
dive in head-first, and my main question is how do you guys write
programs with GUIs? Do you use the gdk toolkit primarily? Also, the
application I eventually have in mind is for automated control of a
microscope, so I need to be able to interface with drivers/serial
ports/firewire/etc. Do you have any advice for me to help me along?
Thanks! Looks like a nice newsgroup to visit.




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
@ 2007-05-03 18:24 ` Dmitry A. Kazakov
  2007-05-03 22:14   ` ezkcdude
  2007-05-04  4:07 ` tmoran
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-03 18:24 UTC (permalink / raw)


On 3 May 2007 10:13:38 -0700, ezkcdude wrote:

> I'm interested in using Ada, so I installed the GNAT compiler on
> Windows (tried on Mac, but I had problems with X11). Anyway, I want to
> dive in head-first, and my main question is how do you guys write
> programs with GUIs?

There are lots of bindings and GUI libraries out here. Here is a list:

http://www.adapower.com/index.php?Command=Class&ClassID=AdaGUI&Title=Ada+GUI

> Do you use the gdk toolkit primarily?

Yes, I am using GTK+ (through GtkAda bindings). It does not make me happy.
GTK+ does not, I mean. IMO, GTK+'s ideology is quite alien to Ada.

And Windows (did you speak about Windows?) support in GTK+ is not that
perfect. But I am sure you will be able to get most of what you wished.

> Also, the
> application I eventually have in mind is for automated control of a
> microscope, so I need to be able to interface with drivers/serial
> ports/firewire/etc.

That should not be a problem if you have drivers for. From Ada you can do
whatever OS calls you wished.

> Do you have any advice for me to help me along?

I would say that for automation, a proper use of tasking is essential. If
your data flow and control is fast, you might get problems with the
event-controlled design of GUI. This is a weak point of many GUI libraries.
You might wish to consider a time-controlled visualization architecture.

Don't try to optimise your code in advance. In these times computers are
quite fast, while sensors and actuators are comparatively slower. So you
can sacrifice some performance for a cleaner software design. Further many
ad-hoc assumptions about efficiency of this or that language construct
often turn wrong. 5-10 ms soft real-time is no more a problem.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-03 18:24 ` Dmitry A. Kazakov
@ 2007-05-03 22:14   ` ezkcdude
  0 siblings, 0 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-03 22:14 UTC (permalink / raw)


Thanks, Dmitry! That was helpful.
-evan

On May 3, 1:24 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On 3 May 2007 10:13:38 -0700, ezkcdude wrote:
>
> > I'm interested in using Ada, so I installed the GNAT compiler on
> > Windows (tried on Mac, but I had problems with X11). Anyway, I want to
> > dive in head-first, and my main question is how do you guys write
> > programs with GUIs?
>
> There are lots of bindings and GUI libraries out here. Here is a list:
>
> http://www.adapower.com/index.php?Command=Class&ClassID=AdaGUI&Title=...
>
> > Do you use the gdk toolkit primarily?
>
> Yes, I am using GTK+ (through GtkAda bindings). It does not make me happy.
> GTK+ does not, I mean. IMO, GTK+'s ideology is quite alien to Ada.
>
> And Windows (did you speak about Windows?) support in GTK+ is not that
> perfect. But I am sure you will be able to get most of what you wished.
>
> > Also, the
> > application I eventually have in mind is for automated control of a
> > microscope, so I need to be able to interface with drivers/serial
> > ports/firewire/etc.
>
> That should not be a problem if you have drivers for. From Ada you can do
> whatever OS calls you wished.
>
> > Do you have any advice for me to help me along?
>
> I would say that for automation, a proper use of tasking is essential. If
> your data flow and control is fast, you might get problems with the
> event-controlled design of GUI. This is a weak point of many GUI libraries.
> You might wish to consider a time-controlled visualization architecture.
>
> Don't try to optimise your code in advance. In these times computers are
> quite fast, while sensors and actuators are comparatively slower. So you
> can sacrifice some performance for a cleaner software design. Further many
> ad-hoc assumptions about efficiency of this or that language construct
> often turn wrong. 5-10 ms soft real-time is no more a problem.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
  2007-05-03 18:24 ` Dmitry A. Kazakov
@ 2007-05-04  4:07 ` tmoran
  2007-05-04 12:57   ` Bob Spooner
  2007-05-04  4:42 ` Jeffrey R. Carter
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: tmoran @ 2007-05-04  4:07 UTC (permalink / raw)


> programs with GUIs? Do you use the gdk toolkit primarily? Also, the
> ...
> application I eventually have in mind is for automated control of a
> microscope, so I need to be able to interface with drivers/serial
> ports/firewire/etc. Do you have any advice for me to help me along?
   Take a look at CLAW (Class Library for Ada and Windows).  There's
a TriAda paper on the design considerations and, for the basic version,
$0 source available at www.rrsoftware.com  (Disclosure: I helped write it.)
   A microscope doesn't sound like it would have severe timing
requirements.  I control my home X10 system with an Ada program using
the serial port with regular Windows calls.



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
  2007-05-03 18:24 ` Dmitry A. Kazakov
  2007-05-04  4:07 ` tmoran
@ 2007-05-04  4:42 ` Jeffrey R. Carter
  2007-05-04  6:48 ` Jacob Sparre Andersen
  2007-05-07  8:01 ` Markus E Leypold
  4 siblings, 0 replies; 47+ messages in thread
From: Jeffrey R. Carter @ 2007-05-04  4:42 UTC (permalink / raw)


ezkcdude wrote:
> I'm interested in using Ada, so I installed the GNAT compiler on
> Windows (tried on Mac, but I had problems with X11). Anyway, I want to
> dive in head-first, and my main question is how do you guys write
> programs with GUIs? Do you use the gdk toolkit primarily? Also, the
> application I eventually have in mind is for automated control of a
> microscope, so I need to be able to interface with drivers/serial
> ports/firewire/etc. Do you have any advice for me to help me along?
> Thanks! Looks like a nice newsgroup to visit.

If you're a beginner, and using Windows, you might like to look at JEWL 
for a GUI, at least at 1st. It's not full featured, but it is easy to 
use. (The event-queue interface might spoil you when you want to switch 
to a more complete library with callbacks.) GtkAda is a pretty good, 
fairly portable library; CLAW is very good if you're willing to stick 
with Windows.

-- 
Jeff Carter
"Mr. President, we must not allow a mine-shaft gap!"
Dr. Strangelove
33



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
                   ` (2 preceding siblings ...)
  2007-05-04  4:42 ` Jeffrey R. Carter
@ 2007-05-04  6:48 ` Jacob Sparre Andersen
  2007-05-07  8:01 ` Markus E Leypold
  4 siblings, 0 replies; 47+ messages in thread
From: Jacob Sparre Andersen @ 2007-05-04  6:48 UTC (permalink / raw)


<zamir.evan@gmail.com> wrote:

> [...] my main question is how do you guys write programs with GUIs?

I use GtkAda.  For prototypes (an occassionally also for the final
version) I use the Glade GUI builder to generate the code, and then
just fill in the application specific code.

> Also, the application I eventually have in mind is for automated
> control of a microscope, so I need to be able to interface with
> drivers/serial ports/firewire/etc. Do you have any advice for me to
> help me along?

It is likely that you will have to look into "package Interfaces.C",
"pragma Import" and representation clauses for that purpose, but it
isn't hard.  And once it is done, you have a nice, elegant interface
to the drivers.

Greetings,

Jacob
-- 
No trees were killed in the sending of this message.
However a large number of electrons were terribly inconvenienced.



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-04  4:07 ` tmoran
@ 2007-05-04 12:57   ` Bob Spooner
  2007-05-04 13:38     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 47+ messages in thread
From: Bob Spooner @ 2007-05-04 12:57 UTC (permalink / raw)


<tmoran@acm.org> wrote in message 
news:a62dnVplZ7QMLKfbnZ2dnUVZ_uOmnZ2d@comcast.com...
>  ...  I control my home X10 system with an Ada program using
> the serial port with regular Windows calls.

Do you have an Ada binding for the Windows serial port driver that 
implements overlapped I/O?

Bob 





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-04 12:57   ` Bob Spooner
@ 2007-05-04 13:38     ` Dmitry A. Kazakov
  2007-05-04 14:40       ` ezkcdude
  2007-05-04 19:19       ` Bob Spooner
  0 siblings, 2 replies; 47+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-04 13:38 UTC (permalink / raw)


On Fri, 4 May 2007 08:57:08 -0400, Bob Spooner wrote:

> <tmoran@acm.org> wrote in message 
> news:a62dnVplZ7QMLKfbnZ2dnUVZ_uOmnZ2d@comcast.com...
>>  ...  I control my home X10 system with an Ada program using
>> the serial port with regular Windows calls.
> 
> Do you have an Ada binding for the Windows serial port driver that 
> implements overlapped I/O?

Win32.Winbase.ReadFile?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-04 13:38     ` Dmitry A. Kazakov
@ 2007-05-04 14:40       ` ezkcdude
  2007-05-04 19:19       ` Bob Spooner
  1 sibling, 0 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-04 14:40 UTC (permalink / raw)


Dmitry, I just wanted to say I appreciate your website, that you put
up code and some really good Ada links, like the Crosstalk issue. This
should be hours of fun for me :)
-evan

On May 4, 8:38 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Fri, 4 May 2007 08:57:08 -0400, Bob Spooner wrote:
> > <tmo...@acm.org> wrote in message
> >news:a62dnVplZ7QMLKfbnZ2dnUVZ_uOmnZ2d@comcast.com...
> >>  ...  I control my home X10 system with an Ada program using
> >> the serial port with regular Windows calls.
>
> > Do you have an Ada binding for the Windows serial port driver that
> > implements overlapped I/O?
>
> Win32.Winbase.ReadFile?
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-04 13:38     ` Dmitry A. Kazakov
  2007-05-04 14:40       ` ezkcdude
@ 2007-05-04 19:19       ` Bob Spooner
  2007-05-04 19:48         ` Dmitry A. Kazakov
  1 sibling, 1 reply; 47+ messages in thread
From: Bob Spooner @ 2007-05-04 19:19 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:tylf07eikj2s.1khde2c9zxxku$.dlg@40tude.net...
> On Fri, 4 May 2007 08:57:08 -0400, Bob Spooner wrote:
>
>> <tmoran@acm.org> wrote in message
>> news:a62dnVplZ7QMLKfbnZ2dnUVZ_uOmnZ2d@comcast.com...
>>>  ...  I control my home X10 system with an Ada program using
>>> the serial port with regular Windows calls.
>>
>> Do you have an Ada binding for the Windows serial port driver that
>> implements overlapped I/O?
>
> Win32.Winbase.ReadFile?
?
Translation please?





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-04 19:19       ` Bob Spooner
@ 2007-05-04 19:48         ` Dmitry A. Kazakov
  2007-05-06 21:46           ` ezkcdude
  0 siblings, 1 reply; 47+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-04 19:48 UTC (permalink / raw)


On Fri, 4 May 2007 15:19:01 -0400, Bob Spooner wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
> news:tylf07eikj2s.1khde2c9zxxku$.dlg@40tude.net...
>> On Fri, 4 May 2007 08:57:08 -0400, Bob Spooner wrote:
>>
>>> <tmoran@acm.org> wrote in message
>>> news:a62dnVplZ7QMLKfbnZ2dnUVZ_uOmnZ2d@comcast.com...
>>>>  ...  I control my home X10 system with an Ada program using
>>>> the serial port with regular Windows calls.
>>>
>>> Do you have an Ada binding for the Windows serial port driver that
>>> implements overlapped I/O?
>>
>> Win32.Winbase.ReadFile?
> ?
> Translation please?

Windows API CreateFile / ReadFile / WriteFile do overlapped I/O for all
devices that support it. COM port does support it (though with Ada tasking
it is simpler to do input and output from two separate tasks, if
full-duplex I/O is all what you need. I don't know, maybe, you want to
handle 100+ ports, then possibly overlapped I/O would make sense.) Anyway,
you don't need any special bindings for doing overlapped I/O beyond Windows
API.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-04 19:48         ` Dmitry A. Kazakov
@ 2007-05-06 21:46           ` ezkcdude
  2007-05-07  7:31             ` Dmitry A. Kazakov
                               ` (2 more replies)
  0 siblings, 3 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-06 21:46 UTC (permalink / raw)


I have a couple more questions. I was reading about Tk as a cross-
platform GUI toolkit, and there is an Ada binding called TASH. This
seems like an interesting way to go. Have any of you guys used TASH or
Tk from Ada? Also, would GtkAda/GLADE be cross-platform? Ideally, I'd
like to write code that could be ported to Linux/OS X (and Windows
obviously). Thanks.
-evan

On May 4, 2:48 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Fri, 4 May 2007 15:19:01 -0400, Bob Spooner wrote:
> > "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote in message
> >news:tylf07eikj2s.1khde2c9zxxku$.dlg@40tude.net...
> >> On Fri, 4 May 2007 08:57:08 -0400, Bob Spooner wrote:
>
> >>> <tmo...@acm.org> wrote in message
> >>>news:a62dnVplZ7QMLKfbnZ2dnUVZ_uOmnZ2d@comcast.com...
> >>>>  ...  I control my home X10 system with an Ada program using
> >>>> the serial port with regular Windows calls.
>
> >>> Do you have an Ada binding for the Windows serial port driver that
> >>> implements overlapped I/O?
>
> >> Win32.Winbase.ReadFile?
> > ?
> > Translation please?
>
> Windows API CreateFile / ReadFile / WriteFile do overlapped I/O for all
> devices that support it. COM port does support it (though with Ada tasking
> it is simpler to do input and output from two separate tasks, if
> full-duplex I/O is all what you need. I don't know, maybe, you want to
> handle 100+ ports, then possibly overlapped I/O would make sense.) Anyway,
> you don't need any special bindings for doing overlapped I/O beyond Windows
> API.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-06 21:46           ` ezkcdude
@ 2007-05-07  7:31             ` Dmitry A. Kazakov
  2007-05-07  7:42             ` Alex R. Mosteo
  2007-05-08  2:58             ` Justin Gombos
  2 siblings, 0 replies; 47+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-07  7:31 UTC (permalink / raw)


On 6 May 2007 14:46:21 -0700, ezkcdude wrote:

> Also, would GtkAda/GLADE be cross-platform? Ideally, I'd
> like to write code that could be ported to Linux/OS X (and Windows
> obviously).

Yes. Linux, Mac OS X and Win32 are supported.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-06 21:46           ` ezkcdude
  2007-05-07  7:31             ` Dmitry A. Kazakov
@ 2007-05-07  7:42             ` Alex R. Mosteo
  2007-05-07  9:15               ` Dmitry A. Kazakov
  2007-05-08  2:58             ` Justin Gombos
  2 siblings, 1 reply; 47+ messages in thread
From: Alex R. Mosteo @ 2007-05-07  7:42 UTC (permalink / raw)


ezkcdude wrote:

> I have a couple more questions. I was reading about Tk as a cross-
> platform GUI toolkit, and there is an Ada binding called TASH. This
> seems like an interesting way to go. Have any of you guys used TASH or
> Tk from Ada? Also, would GtkAda/GLADE be cross-platform? Ideally, I'd
> like to write code that could be ported to Linux/OS X (and Windows
> obviously). Thanks.

No experience with TASH here.

GtkAda works in Linux and Windows at least; no idea about OSX. However, it
is too bulky for my tastes, in the sense that you need lots of glue code
for the simplest callback. Then, I don't like either the look of GTK+
(there are L'n'Feels I guess) and working with TreeViews is another tiring
process (but the C++ examples show that this is not the fault of GtkAda).
That said, I've seen great looking apps written with GtkAda (one for xfig
figures and another one for musical scales, whose names I don't remember
right now, are the first ones that come to my mind).

Recently was an announcemente of a Qt binding, so there are two different
ones out right now I think, but can't say about its maturity. I remember
from my C++ days that Qt was easy to use... but how well this traslates to
the Ada side I don't know.

The approach I've used for my last projects that required a GUI were either
very simple (and ugly) ones with GtkAda or a web interface using AWS. If
you don't need quick refresh, this last approach is completely
cross-platform, easy to learn and program and you can use any HTML editor
for the static parts. The template engine is easy to use and has been
powerful enough for everything I've needed. Also you can embed in the
executable all needed files.



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
                   ` (3 preceding siblings ...)
  2007-05-04  6:48 ` Jacob Sparre Andersen
@ 2007-05-07  8:01 ` Markus E Leypold
  2007-05-08 14:40   ` ezkcdude
  4 siblings, 1 reply; 47+ messages in thread
From: Markus E Leypold @ 2007-05-07  8:01 UTC (permalink / raw)



ezkcdude <zamir.evan@gmail.com> writes:

> I'm interested in using Ada, so I installed the GNAT compiler on
> Windows (tried on Mac, but I had problems with X11). Anyway, I want to
> dive in head-first, and my main question is how do you guys write
> programs with GUIs? Do you use the gdk toolkit primarily? Also, the
> application I eventually have in mind is for automated control of a
> microscope, so I need to be able to interface with drivers/serial
> ports/firewire/etc. Do you have any advice for me to help me along?

My advice would be to be a bit cautious with advice from c.l.a.:
People there tend to advocate Ada and therefore are slightly prone to
overlook problems with tools, libraries and (dare I say it) licenses.

This is not bad will, but basically a problem of perspective: You will
find threads that end with: "I don't have that problem" ... "Well, I'm
using my employers infrastructure, we've licensed Gnat Pro". Then the
discussion starts, why it is "not an option" for you to license Gnat
Pro.

> Thanks! Looks like a nice newsgroup to visit.

It certainly is a nice newsgroup, with a number of technically really
savy people. But a bit biased in some respects, so be cautious WRT
strategic advice (like: what is a problem, what isn't, what are the
payoffs or disadvantages of decisions, what you "should" be doing). At
the end of the day your decisions are your own responsibility and
"some guy at the usenet told me" is rarely a good rationale and hardly
a good excuse.

Better do some (additional) research of your own (and document your
findings and your rationales, just in case you have to justify your
decisions some time).


Regards -- Markus






^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-07  7:42             ` Alex R. Mosteo
@ 2007-05-07  9:15               ` Dmitry A. Kazakov
  0 siblings, 0 replies; 47+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-07  9:15 UTC (permalink / raw)


On Mon, 07 May 2007 10:42:58 +0300, Alex R. Mosteo wrote:

> GtkAda works in Linux and Windows at least; no idea about OSX. However, it
> is too bulky for my tastes, in the sense that you need lots of glue code
> for the simplest callback. Then, I don't like either the look of GTK+
> (there are L'n'Feels I guess) and working with TreeViews is another tiring
> process (but the C++ examples show that this is not the fault of GtkAda).

Yes, me too.

> That said, I've seen great looking apps written with GtkAda (one for xfig
> figures and another one for musical scales, whose names I don't remember
> right now, are the first ones that come to my mind).
> 
> Recently was an announcemente of a Qt binding, so there are two different
> ones out right now I think, but can't say about its maturity. I remember
> from my C++ days that Qt was easy to use... but how well this traslates to
> the Ada side I don't know.

Maybe, however, more widget libraries I see, more it makes me to believe
that widgets should be designed in Ada with a native Ada interface.

Also, what perplexes me, is an open contradiction between heavily dynamic
architecture of the widget libraries and predominant static use of. It is
quite awkward. One first makes everything dynamic with all the
disadvantages of not knowing what, when and if it will be emitted, handled,
resized, destroyed etc. Just in order to roll everything back with tools
like GLADE. Something is wrong here.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-06 21:46           ` ezkcdude
  2007-05-07  7:31             ` Dmitry A. Kazakov
  2007-05-07  7:42             ` Alex R. Mosteo
@ 2007-05-08  2:58             ` Justin Gombos
  2007-05-08 11:58               ` ezkcdude
  2 siblings, 1 reply; 47+ messages in thread
From: Justin Gombos @ 2007-05-08  2:58 UTC (permalink / raw)


On 2007-05-06, ezkcdude <zamir.evan@gmail.com> wrote:
>
> Ideally, I'd like to write code that could be ported to Linux/OS X
> (and Windows obviously).

It's not clear to me why porting to Windows would be an obvious need.
Is this controlling microscopes for children in elementary schools?
If not, why would you want to control a microscope from the poorest
quality system available for which consumers pay a premium for, and
subject users in the scientific community to the Fisher Price of
operating systems?

-- 
PM instructions: do a C4esar Ciph3r on my address; retain punctuation.



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08  2:58             ` Justin Gombos
@ 2007-05-08 11:58               ` ezkcdude
  0 siblings, 0 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-08 11:58 UTC (permalink / raw)


>
> It's not clear to me why porting to Windows would be an obvious need.

Well, the main reason is that there still is very little hardware
support for linux in this field.






^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-07  8:01 ` Markus E Leypold
@ 2007-05-08 14:40   ` ezkcdude
  2007-05-08 15:07     ` Pascal Obry
                       ` (4 more replies)
  0 siblings, 5 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-08 14:40 UTC (permalink / raw)


Markus, thanks for the advice. I'm one of those people who loves to do
the "right" thing, and it seems to me like Ada is, in theory, a great
programming language. Of course, one has to be practical. The main
issues that I am trying to wrestle with is how I would implement a GUI
and, in general, handle graphics (display, manipulation, input/
output). Java seems much more ready-made for these tasks at the
moment, and I don't see the Ada packages have that much enthusiasm or
support. It's unfortunate, because like I said, Ada seems like the
"right" language to me for most of what my objectives are.

One idea I have, and I'd love to hear advice or comments, is to use
Ada as the "engine" for my program, and somehow use Java to create the
GUI and deal with images. Does this seem like a possibility?
-evan

On May 7, 3:01 am, Markus E Leypold
<development-2006-8ecbb5cc8aREMOVET...@ANDTHATm-e-leypold.de> wrote:
> ezkcdude <zamir.e...@gmail.com> writes:
> > I'm interested in using Ada, so I installed the GNAT compiler on
> > Windows (tried on Mac, but I had problems with X11). Anyway, I want to
> > dive in head-first, and my main question is how do you guys write
> > programs with GUIs? Do you use the gdk toolkit primarily? Also, the
> > application I eventually have in mind is for automated control of a
> > microscope, so I need to be able to interface with drivers/serial
> > ports/firewire/etc. Do you have any advice for me to help me along?
>
> My advice would be to be a bit cautious with advice from c.l.a.:
> People there tend to advocate Ada and therefore are slightly prone to
> overlook problems with tools, libraries and (dare I say it) licenses.
>
> This is not bad will, but basically a problem of perspective: You will
> find threads that end with: "I don't have that problem" ... "Well, I'm
> using my employers infrastructure, we've licensed Gnat Pro". Then the
> discussion starts, why it is "not an option" for you to license Gnat
> Pro.
>
> > Thanks! Looks like a nice newsgroup to visit.
>
> It certainly is a nice newsgroup, with a number of technically really
> savy people. But a bit biased in some respects, so be cautious WRT
> strategic advice (like: what is a problem, what isn't, what are the
> payoffs or disadvantages of decisions, what you "should" be doing). At
> the end of the day your decisions are your own responsibility and
> "some guy at the usenet told me" is rarely a good rationale and hardly
> a good excuse.
>
> Better do some (additional) research of your own (and document your
> findings and your rationales, just in case you have to justify your
> decisions some time).
>
> Regards -- Markus





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 14:40   ` ezkcdude
@ 2007-05-08 15:07     ` Pascal Obry
  2007-05-08 15:27       ` ezkcdude
  2007-05-08 16:11     ` Markus E Leypold
                       ` (3 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Pascal Obry @ 2007-05-08 15:07 UTC (permalink / raw)
  To: ezkcdude

ezkcdude a �crit :
> Markus, thanks for the advice. I'm one of those people who loves to do
> the "right" thing, and it seems to me like Ada is, in theory, a great
> programming language. Of course, one has to be practical. The main
> issues that I am trying to wrestle with is how I would implement a GUI
> and, in general, handle graphics (display, manipulation, input/
> output). Java seems much more ready-made for these tasks at the
> moment, and I don't see the Ada packages have that much enthusiasm or
> support. It's unfortunate, because like I said, Ada seems like the
> "right" language to me for most of what my objectives are.

I don't understand that, did you really had a look at GtkAda (some have
commented that they don't like it, fine) ? GPS is developed with it,
looks like GtkAda is quite capable... Another solution for Ada is to use
AWS, the Ada application can then be accessed with a standard browser.
This of course impose that the GUI be not too "fancy", yet with the
AWS/Ajax support there is still some nice GUI to build.

> One idea I have, and I'd love to hear advice or comments, is to use
> Ada as the "engine" for my program, and somehow use Java to create the
> GUI and deal with images. Does this seem like a possibility?

Everything is possible :) Java GUI are so ugly that I won't even
consider this a solution. At least GtkAda as native look&feel (not 100%
ok but far better than Java).

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 15:07     ` Pascal Obry
@ 2007-05-08 15:27       ` ezkcdude
  2007-05-08 15:54         ` Pascal Obry
                           ` (3 more replies)
  0 siblings, 4 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-08 15:27 UTC (permalink / raw)


Thanks, Pascal. Here are my responses.

>
> I don't understand that, did you really had a look at GtkAda (some have
> commented that they don't like it, fine) ?

Dmitry and others commented on this in this thread.

>GPS is developed with it,
> looks like GtkAda is quite capable...

It's not so much look, but the ease of doing it. For example, I would
like something like the GUI builders you can find in NetBeans. Glade
is similar, but then you have the XML stuff, which seems like even
more overhead to learn. I noticed that the version of glade bundled
with GtkAda in GPS is not the most current version. The current
version of Glade does not output source code, only XML.

> Another solution for Ada is to use
> AWS, the Ada application can then be accessed with a standard browser.
> This of course impose that the GUI be not too "fancy", yet with the
> AWS/Ajax support there is still some nice GUI to build.

I really don't want to get into web programming. That would be even
more languages to learn.

>
> Everything is possible :) Java GUI are so ugly that I won't even
> consider this a solution. At least GtkAda as native look&feel (not 100%
> ok but far better than Java).

I am not really concerned with looks. Most important are 1)
functionality 2) performance and 3) ease of programming. Java really
seems to have the upper hand in #3. Is this not the case?





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 15:27       ` ezkcdude
@ 2007-05-08 15:54         ` Pascal Obry
  2007-05-08 16:07         ` Georg Bauhaus
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 47+ messages in thread
From: Pascal Obry @ 2007-05-08 15:54 UTC (permalink / raw)
  To: ezkcdude

ezkcdude a �crit :

> like something like the GUI builders you can find in NetBeans. Glade
> is similar, but then you have the XML stuff, which seems like even
> more overhead to learn. I noticed that the version of glade bundled

XML is an intermediate representation for the GUI, no need to learn
anything, gate will generate the Ada code for you. You don't even need
to look at the generated XML.

> I really don't want to get into web programming. That would be even
> more languages to learn.

More languages ? AWS/Ajax is mostly Ada. Ajax support is done through
ready-to-use template tags. You'll have at least to know a bit of XML
and XHTML.

> I am not really concerned with looks. Most important are 1)
> functionality 2) performance and 3) ease of programming. Java really
> seems to have the upper hand in #3. Is this not the case?

Yes it *seems* to have... In Java everything *seems* to be easy... then
comes reality :) Java is by far the last technology to use for building
GUI, just look around there is not that much Java GUI applications. Java
is mostly used on the server side for Web developments.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 15:27       ` ezkcdude
  2007-05-08 15:54         ` Pascal Obry
@ 2007-05-08 16:07         ` Georg Bauhaus
  2007-05-08 18:42           ` Markus E Leypold
  2007-05-08 16:18         ` Ali Bendriss
  2007-05-08 19:23         ` Michael Bode
  3 siblings, 1 reply; 47+ messages in thread
From: Georg Bauhaus @ 2007-05-08 16:07 UTC (permalink / raw)


On Tue, 2007-05-08 at 08:27 -0700, ezkcdude wrote:

> I am not really concerned with looks. Most important are 1)
> functionality 2) performance and 3) ease of programming. Java really
> seems to have the upper hand in #3. Is this not the case?

You can write a graphical front end easily using a toolset of your
choice and have the graphical front end talk to the Ada backend
using like RPC, Corba, or just simple pipes; basically
any one of the commonly used protocol styles should work. 

Maybe there is additional benefit in defining a simple
command language for controlling the microscope; the graphical
front end will send the commands, the control back end (Ada)
interprets the commands, and reports status information in
return.





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 14:40   ` ezkcdude
  2007-05-08 15:07     ` Pascal Obry
@ 2007-05-08 16:11     ` Markus E Leypold
  2007-05-08 16:49       ` ezkcdude
  2007-05-08 18:28     ` Alex R. Mosteo
                       ` (2 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Markus E Leypold @ 2007-05-08 16:11 UTC (permalink / raw)



ezkcdude <zamir.evan@gmail.com> writes:

> Markus, thanks for the advice. I'm one of those people who loves to do
> the "right" thing, and it seems to me like Ada is, in theory, a great
> programming language. Of course, one has to be practical. The main

In theory.

> issues that I am trying to wrestle with is how I would implement a GUI
> and, in general, handle graphics (display, manipulation, input/
> output). 

I've been using GtkAda in the past. It is workable, but one has to
realize that GUIs are a problem in themselves: Lot's of
text-to-whatever-type conversion when you read stuff from the GUI back
into your program (and if you have, say 70 fields of all different
types in you program that means you have (at least) 140 functions
text->typed data and typed-data->text. Some kind of generic,
meta-programming or generation from definition obviously must take
place then.

GUIs are also rather stateful and inherently concurrent (you cannot
prevent the use from clicking button X while you're processing another
data entry event that might disable X).

It boils down to the result that GUIs introduce a huge load of
complexity into programs where a sequential interaction would be
trivial.

About GtkAda: 

 - Docs: The docs are somewhat spurious: You have to be able to read
   the original Gtk-Docs against them and then you still have to be
   able to read the source to find out what really happens. Good
   examples are rare.

 - License: Is pure GPL whereas Gtk is LGPL. This might not matter to
   you, but I've really been bitten by the license change from GMGPL
   with linking exception, and further enraged by the abolutely
   surreal prevarication I got from AdaCore (always offensively trying
   to imply that there never was a linking exception w/o actually
   saying so -- probably because this would have clashed with the hard
   evidence :-) when asking when the license change took place -- so I
   won't forget to mention it here.

 - Portability: last time I checked, GtkAda only worked with Gnat (and
   specific versions too). So you'll be locked to Gnat (probably)
   which opens up all those can of worms with the different licensing
   and maturity of the compilers (which you should try to research for
   yourself, since that is a really long story).

> Java seems much more ready-made for these tasks at the moment, and I
> don't see the Ada packages have that much enthusiasm or
> support. It's unfortunate, because like I said, Ada seems like the
> "right" language to me for most of what my objectives are.

c.l.a folks will now hate me: Have you considered a language like
Ocaml? As with Java there is garbage collection, which is a real boon
with a dynamic GUI, the lablgtk docs are comparably good and the
functional style of programming interacts really well with GUI
programming.

> One idea I have, and I'd love to hear advice or comments, is to use
> Ada as the "engine" for my program, and somehow use Java to create the
> GUI and deal with images. Does this seem like a possibility?

"Remote widget protocols" like this (i.e. haveing a separate process
as display server to which you talk in a high level protocol and
instantiate complete widgets) have been created in the past (wether in
Ada I don't know). Perhaps you can find some information about this
somewhere. it is certainly an option, but you'll still have the
necessity to design the protocol (not so easy) and a useful GUI
abstraction (though that might not be as difficult as it looks, since
you would probably try for an application specific GUI abstraction.

And never forget: Don't believe me. Do your own research to bolster
whatever you gather from what I say. There are much too many unfounded
assertions floating around in usenet.

Let me add a personal judgement: 

| I'm one of those people who loves to do the "right" thing, and it
| seems to me like Ada is, in theory, a great

I suspect that Ada is not the right language for a lot of things any
more. "Right" is defined by the context and what is available, also by
who has to maintain the code later. Going for a dual-language strategy
on a non-embedded platform seems to me the right thing today: A
language with garbage collection and type system you're comfortable
with for the high level stuff and C for the lowlevel / driver stuff
(of course you have to know how to write C ... :-). The high level
language should work with Gtk or another portable toolkit
(wxwidgets? Qt? Any other?).

Suggestions are:

  - Phyton + C: Very popular, but no type systems. Rumoured to be
    slow. Good syntax (i.e. readable)

  - Perl + C: Very large number of libs in CPAN, but lots of them of
    dubious quality. Bad, really

  - Ada + C: No GC in Ada (you can add the Boehm collector
    though). I'm doubtful about continued (and comparable and
    affordable) support on Unix AND Windows platforms.

  - Java + C: Never tried native function interfacing in Java, but its
    rumoured to be possible. I don't like the "everything is an object
    way though". It makes for clumsy callback definitions and Java
    before 1.5 is definitely hampered by the absence of parametric
    polymorphism or generics (which you need to define generic
    containers in a type safe way).

  - Of course the C#/.NET/Mono way: I've even seen projects that
    intended to GUIs for operating machines that way.

The '+C' seems to be a constant. If you want to program portable GUIs
(i.e. on Windows and Unix) the most efficient approach would be to look
for the protable GUI toolkits (not many), then look for their language
support, look how mature and maintained it is (that kicks all
languages that have had one Gtk-whatever release 2 years ago and than
never again) and you're left with only a handful.

The other possible approach is, of course, to write a "control kernel"
in some suitable language and interface it with a suitable GUI by
sockets and/or pipe with some out-of-the-box or even self styled RPC
mechanism. You already mentioned that.

Regards -- Markus

PS: And please don't top post.




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 15:27       ` ezkcdude
  2007-05-08 15:54         ` Pascal Obry
  2007-05-08 16:07         ` Georg Bauhaus
@ 2007-05-08 16:18         ` Ali Bendriss
  2007-05-08 19:23         ` Michael Bode
  3 siblings, 0 replies; 47+ messages in thread
From: Ali Bendriss @ 2007-05-08 16:18 UTC (permalink / raw)
  To: comp.lang.ada

Hello,

On Tuesday 08 May 2007 16:27, ezkcdude wrote:
> Thanks, Pascal. Here are my responses.
>
> > I don't understand that, did you really had a look at GtkAda (some have
> > commented that they don't like it, fine) ?
>
> Dmitry and others commented on this in this thread.
>
> >GPS is developed with it,
> > looks like GtkAda is quite capable...
>
> It's not so much look, but the ease of doing it. For example, I would
> like something like the GUI builders you can find in NetBeans. Glade
> is similar, but then you have the XML stuff, which seems like even
> more overhead to learn. I noticed that the version of glade bundled
> with GtkAda in GPS is not the most current version. The current
> version of Glade does not output source code, only XML.
>
You usually don't have to edit that xml file directly, Glade/Gate will do the 
job for you.

> > Another solution for Ada is to use
> > AWS, the Ada application can then be accessed with a standard browser.
> > This of course impose that the GUI be not too "fancy", yet with the
> > AWS/Ajax support there is still some nice GUI to build.
>
> I really don't want to get into web programming. That would be even
> more languages to learn.
>
a web browser has some great graphics capabilities, just send your image in a 
format it can understand (png, jpeg, gif, svg). It will as well save you some 
time by implementing natively encryption, printing, fonts,history...  

> > Everything is possible :) Java GUI are so ugly that I won't even
> > consider this a solution. At least GtkAda as native look&feel (not 100%
> > ok but far better than Java).
>
> I am not really concerned with looks. Most important are 1)
> functionality 2) performance and 3) ease of programming. Java really
> seems to have the upper hand in #3. Is this not the case?
>
Java is able as well to run as an applet and some GUI using the multithreading  
are really responsive. But we are in c.l.ada isn't it so : 

Maybe the best tools to start writing a GUI are pens, scissors and some 
papers. After you will have the choice of  different libs as mentioned before 
to implement it. I will just add :
- TASH  http://tcladashell.sourceforge.net/
- AdaSDL http://www.libsdl.org/languages.php

I've already used the second, and it's fine to manage simple events.

You need as well to think how your engine and your GUI will communicate.

-- 
Ali 



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 16:11     ` Markus E Leypold
@ 2007-05-08 16:49       ` ezkcdude
  2007-05-08 18:20         ` Ludovic Brenta
  2007-05-08 18:45         ` Markus E Leypold
  0 siblings, 2 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-08 16:49 UTC (permalink / raw)


On May 8, 11:11 am, Markus E Leypold
<development-2006-8ecbb5cc8aREMOVET...@ANDTHATm-e-leypold.de> wrote:
> ezkcdude <zamir.e...@gmail.com> writes:
> > Markus, thanks for the advice. I'm one of those people who loves to do
> > the "right" thing, and it seems to me like Ada is, in theory, a great
> > programming language. Of course, one has to be practical. The main
>
> In theory.
>
> > issues that I am trying to wrestle with is how I would implement a GUI
> > and, in general, handle graphics (display, manipulation, input/
> > output).
>
> I've been using GtkAda in the past. It is workable, but one has to
> realize that GUIs are a problem in themselves: Lot's of
> text-to-whatever-type conversion when you read stuff from the GUI back
> into your program (and if you have, say 70 fields of all different
> types in you program that means you have (at least) 140 functions
> text->typed data and typed-data->text. Some kind of generic,
> meta-programming or generation from definition obviously must take
> place then.
>
> GUIs are also rather stateful and inherently concurrent (you cannot
> prevent the use from clicking button X while you're processing another
> data entry event that might disable X).
>
> It boils down to the result that GUIs introduce a huge load of
> complexity into programs where a sequential interaction would be
> trivial.
>
> About GtkAda:
>
>  - Docs: The docs are somewhat spurious: You have to be able to read
>    the original Gtk-Docs against them and then you still have to be
>    able to read the source to find out what really happens. Good
>    examples are rare.
>
>  - License: Is pure GPL whereas Gtk is LGPL. This might not matter to
>    you, but I've really been bitten by the license change from GMGPL
>    with linking exception, and further enraged by the abolutely
>    surreal prevarication I got from AdaCore (always offensively trying
>    to imply that there never was a linking exception w/o actually
>    saying so -- probably because this would have clashed with the hard
>    evidence :-) when asking when the license change took place -- so I
>    won't forget to mention it here.
>
>  - Portability: last time I checked, GtkAda only worked with Gnat (and
>    specific versions too). So you'll be locked to Gnat (probably)
>    which opens up all those can of worms with the different licensing
>    and maturity of the compilers (which you should try to research for
>    yourself, since that is a really long story).
>
> > Java seems much more ready-made for these tasks at the moment, and I
> > don't see the Ada packages have that much enthusiasm or
> > support. It's unfortunate, because like I said, Ada seems like the
> > "right" language to me for most of what my objectives are.
>
> c.l.a folks will now hate me: Have you considered a language like
> Ocaml? As with Java there is garbage collection, which is a real boon
> with a dynamic GUI, the lablgtk docs are comparably good and the
> functional style of programming interacts really well with GUI
> programming.
>
> > One idea I have, and I'd love to hear advice or comments, is to use
> > Ada as the "engine" for my program, and somehow use Java to create the
> > GUI and deal with images. Does this seem like a possibility?
>
> "Remote widget protocols" like this (i.e. haveing a separate process
> as display server to which you talk in a high level protocol and
> instantiate complete widgets) have been created in the past (wether in
> Ada I don't know). Perhaps you can find some information about this
> somewhere. it is certainly an option, but you'll still have the
> necessity to design the protocol (not so easy) and a useful GUI
> abstraction (though that might not be as difficult as it looks, since
> you would probably try for an application specific GUI abstraction.
>
> And never forget: Don't believe me. Do your own research to bolster
> whatever you gather from what I say. There are much too many unfounded
> assertions floating around in usenet.
>
> Let me add a personal judgement:
>
> | I'm one of those people who loves to do the "right" thing, and it
> | seems to me like Ada is, in theory, a great
>
> I suspect that Ada is not the right language for a lot of things any
> more. "Right" is defined by the context and what is available, also by
> who has to maintain the code later. Going for a dual-language strategy
> on a non-embedded platform seems to me the right thing today: A
> language with garbage collection and type system you're comfortable
> with for the high level stuff and C for the lowlevel / driver stuff
> (of course you have to know how to write C ... :-). The high level
> language should work with Gtk or another portable toolkit
> (wxwidgets? Qt? Any other?).
>
> Suggestions are:
>
>   - Phyton + C: Very popular, but no type systems. Rumoured to be
>     slow. Good syntax (i.e. readable)
>
>   - Perl + C: Very large number of libs in CPAN, but lots of them of
>     dubious quality. Bad, really
>
>   - Ada + C: No GC in Ada (you can add the Boehm collector
>     though). I'm doubtful about continued (and comparable and
>     affordable) support on Unix AND Windows platforms.
>
>   - Java + C: Never tried native function interfacing in Java, but its
>     rumoured to be possible. I don't like the "everything is an object
>     way though". It makes for clumsy callback definitions and Java
>     before 1.5 is definitely hampered by the absence of parametric
>     polymorphism or generics (which you need to define generic
>     containers in a type safe way).
>
>   - Of course the C#/.NET/Mono way: I've even seen projects that
>     intended to GUIs for operating machines that way.
>
> The '+C' seems to be a constant. If you want to program portable GUIs
> (i.e. on Windows and Unix) the most efficient approach would be to look
> for the protable GUI toolkits (not many), then look for their language
> support, look how mature and maintained it is (that kicks all
> languages that have had one Gtk-whatever release 2 years ago and than
> never again) and you're left with only a handful.
>
> The other possible approach is, of course, to write a "control kernel"
> in some suitable language and interface it with a suitable GUI by
> sockets and/or pipe with some out-of-the-box or even self styled RPC
> mechanism. You already mentioned that.
>
> Regards -- Markus
>
> PS: And please don't top post.

Sorry about the "top posting". I never really thought about that.

As for your reply, thanks, so much! You guys are awesome. I'm not sure
I'm any closer to an answer, but at least, I know a lot of the
questions involved. At this point, that's enough for me.




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 16:49       ` ezkcdude
@ 2007-05-08 18:20         ` Ludovic Brenta
  2007-05-08 21:17           ` Markus E Leypold
  2007-05-08 18:45         ` Markus E Leypold
  1 sibling, 1 reply; 47+ messages in thread
From: Ludovic Brenta @ 2007-05-08 18:20 UTC (permalink / raw)


ezkcdude writes:
> As for your reply, thanks, so much! You guys are awesome. I'm not
> sure I'm any closer to an answer, but at least, I know a lot of the
> questions involved. At this point, that's enough for me.

At one point you asked whether writing the "engine" in Ada and the GUI
in another language was a option; the answer is "yes, there are
several ways".  But OTOH you seem reluctant to learn more than one
language, and you also seem to lack experience with GUI programming,
so you're unbiased as to which toolkit you should use.

Personally I used Java Swing about 7 years ago, and wrote a quick toy
GUI with GtkAda a couple of years ago in one afternoon.  I used glade,
generated Ada code from the XML file and, wanting to learn more by
myself, rewrote the Ada by hand in what I thought was a cleaner way.
I think both Java/Swing and Ada/GtkAda are equally difficult, or
equally easy, to use.  If you like you can browse the sources for this
toy program here:

http://www.ada-france.org:8081/branch/changes/org.ludovic-brenta.meyse

(the licese is PURE GPL, sorry Markus :)).  You'll notice that the
"engine" and GUI are in separate packages, and the program runs
equally well on the command line as with a GUI (i.e. with a command
line parameter, it doesn't start the GUI).

So, if I were you I'd go for GtkAda and avoid learning another
language just for the GUI.  But rest assured that no matter what
language and toolkit you use, GUI programs are many times larger and
more complex than command-line programs, and be prepared to spend most
of your time doing "boring" stuff like building dialog boxes.  Also be
prepared for a steep learning curve with any toolkit you choose.
Sounds like a lot of fun, doesn't it?

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 14:40   ` ezkcdude
  2007-05-08 15:07     ` Pascal Obry
  2007-05-08 16:11     ` Markus E Leypold
@ 2007-05-08 18:28     ` Alex R. Mosteo
  2007-05-08 18:51       ` ezkcdude
  2007-05-10 18:14     ` Newbie Needs Ada Advice Chip and Allie Orange
  2007-05-27  5:50     ` adaworks
  4 siblings, 1 reply; 47+ messages in thread
From: Alex R. Mosteo @ 2007-05-08 18:28 UTC (permalink / raw)


ezkcdude wrote:

> One idea I have, and I'd love to hear advice or comments, is to use
> Ada as the "engine" for my program, and somehow use Java to create the
> GUI and deal with images. Does this seem like a possibility?
> -evan

I've done this, or something similar. My core was a stand-alone Ada program,
with SOAP web services (again, thanks to AWS) for feedback/command. Any
compliant soap client could interact with my core, and in fact I had a java
one.

If you want to have a single executable, I don't know how to link with
java... unless you use gjc I suppose (or jgnat, but I understand is heavily
outdated and unmaintained). But then, you can easily go the Ada+C+C++ way.
Calling Ada from C/C++ is easy; C from Ada likewise. C++ is a bigger
problem that I usually avoid with a simple C gluing layer.

Then, all the myriads of libraries in C/C++ are there for you, and you can
program the part you deem necessary in Ada (if any, of course).

As an example: my current project uses a core in Ada, that interfaces with a
robotic library for both control and simulation that has a C API.
Furthermore, I must exchange data using YARP (a C++ library) with some
modules programmed by colleagues, and I do this with just a simple C++ file
with extern "C" exports for calling from Ada.

In truth, there's some overhead in going mixed-language. But once you define
interfaces and stick to them, the rest is piece of cake.

But if your non-Ada concern is a good GUI, maybe you should take a look a
the Ada bindings first. Maybe GtkAda is your deal (though if you're an Ada
newcomer I don't think so :) or one of the others is...

I don't really know how people build the amazing GUIs I see in my KDE
desktop. Which tools are out there? KDevelop? Some Qt builder? Glade
doesn't impress me much, I think I'm also missing something in the Gtk+
side.

As the bottom line of my personal current oppinion: if I were to build a
good GUI for my Ada code, I'd use whatever toolkit I liked best, in its
native language, and glue it to Ada via C exports.



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 16:07         ` Georg Bauhaus
@ 2007-05-08 18:42           ` Markus E Leypold
  0 siblings, 0 replies; 47+ messages in thread
From: Markus E Leypold @ 2007-05-08 18:42 UTC (permalink / raw)



Georg Bauhaus <rm.tsoh+bauhaus@maps.futureapps.de> writes:

> On Tue, 2007-05-08 at 08:27 -0700, ezkcdude wrote:
>
>> I am not really concerned with looks. Most important are 1)
>> functionality 2) performance and 3) ease of programming. Java really
>> seems to have the upper hand in #3. Is this not the case?
>
> You can write a graphical front end easily using a toolset of your
> choice and have the graphical front end talk to the Ada backend
> using like RPC, Corba, or just simple pipes; basically
> any one of the commonly used protocol styles should work. 
>
> Maybe there is additional benefit in defining a simple
> command language for controlling the microscope; the graphical
> front end will send the commands, the control back end (Ada)
> interprets the commands, and reports status information in
> return.

And additional advantage would be, that commandline or script-based
command language would practically come naturally. The more I think
about it, the more I like the idea.

Regards -- Markus



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 16:49       ` ezkcdude
  2007-05-08 18:20         ` Ludovic Brenta
@ 2007-05-08 18:45         ` Markus E Leypold
  1 sibling, 0 replies; 47+ messages in thread
From: Markus E Leypold @ 2007-05-08 18:45 UTC (permalink / raw)



ezkcdude <zamir.evan@gmail.com> writes:

>>
>> PS: And please don't top post.
>
> Sorry about the "top posting". I never really thought about that.

Next step is the "trim quotes down to a meaningful subset" lesson :-)

> As for your reply, thanks, so much! You guys are awesome. I'm not sure

Well, thanks :-). I'm mostly a habitual dissenter, though.

> I'm any closer to an answer, but at least, I know a lot of the
> questions involved. At this point, that's enough for me.

Quite right. Additionally, what is even more important, that one can
live with ones own decisions. 

Regards -- Markus





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 18:28     ` Alex R. Mosteo
@ 2007-05-08 18:51       ` ezkcdude
  2007-05-08 19:31         ` Michael Bode
                           ` (2 more replies)
  0 siblings, 3 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-08 18:51 UTC (permalink / raw)


All helpful responses. Thanks. One idea that now makes some sense
(having thought about it for all of a couple of hours), is that the
GUI/interface could be a separate application that simply sets up the
experiment (i.e. microscope configuration). For example, creating an
XML document with appropriate hardware parameters, and then feeding
this document to the "engine", which actually controls the microscope.
The GUI could then be written using something even more high-level
(like my favorite language MATLAB!). The engine could be written in
Ada. I could also write another application that would graphically
monitor the ongoing experiment (i.e. display images).  This monitor
could be web based, and simply interact with the data that is acquired
by the microscope controller engine.

The only issue that still bugs me is that most of the hardware drivers
for the major microscope manufacturers (Leica, Nikon, Olympus, Zeiss)
are in C/C++, so there will still be a need to interface Ada/C/C++ to
some extent.





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 15:27       ` ezkcdude
                           ` (2 preceding siblings ...)
  2007-05-08 16:18         ` Ali Bendriss
@ 2007-05-08 19:23         ` Michael Bode
  3 siblings, 0 replies; 47+ messages in thread
From: Michael Bode @ 2007-05-08 19:23 UTC (permalink / raw)


ezkcdude <zamir.evan@gmail.com> writes:

> It's not so much look, but the ease of doing it. For example, I would
> like something like the GUI builders you can find in NetBeans. Glade
> is similar, but then you have the XML stuff, which seems like even
> more overhead to learn. I noticed that the version of glade bundled
> with GtkAda in GPS is not the most current version. The current
> version of Glade does not output source code, only XML.

I'm not sure what your problem with XML is. You never need to look at
the XML glade generates. The 'standard' way is to use gate to generate
Ada code. I'm using myself the 'other' way: use libglade to build the
GUI from the XML file. One disadvantage of this method is that you
more or less use only the predefined widget types and can't derive new
types from those. On the plus side you get internationalisation for
free because Gnu gettext works just fine with glade files. One
example:

procedure Create_Window (Window : in out Window_Record;
                         Fname  :        String;
                         Root   :        String)
is
begin
   Gtk_New (XML => Window.XML,
            Fname => Fname,
            Root => Root,
            Domain => Application.I18n_Textdomain);
   Window.Window := Gtk_Window (Get_Widget (Window.XML, Root));
end Create_Window;

I call this procedure 5 times in one of my apps for 5 different
windows and it pulls in 19874 lines of XML using the right language
for labels etc. and build the whole gui. What I have to do in code is
connect Ada variables to the widgets like that:

Main_Window.Connect_Btn := Gtk_Button (Get_Widget (Main_Window.XML, "connect"));

and connect callbacks:

Button_Handlers.Connect (Main_Window.Connect_Btn, "clicked",
                         Button_Handlers.To_Marshaller (Connect_Cb'Access));

> I am not really concerned with looks. Most important are 1)
> functionality 2) performance and 3) ease of programming. Java really
> seems to have the upper hand in #3. Is this not the case?

Sometimes code generators generate the right code, sometimes you
better code by hand. Suppose you have 5 unrelated checkboxes in your
window. A GUI code generator will generate 5 unrelated widget
variables and 5 unrelated callback functions to handle the "clicked"
events. Fine.

No suppose you have 32 checkboxes that form a logical array. The code
generator will generate 32 unrelated widget variables and 32 callback
functions. The human programmer will write an array of widgets,
generate them in a loop and handle the events in one callback
function.

I'm just starting to look into Java, so I'm only guessing. I believe
even if GUI programming might be easier interfacing to your hardware
(drives, cameras, whatever) might be harder in Java.

I've myself a similar project on my todo list which keeps getting
delayed again and again. I think I got as far a reading the serial
number off of the camera :-(

-- 
No intelligent man has any respect for an unjust law. 
He simply follows the eleventh commandment.
-- R.A. Heinlein



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 18:51       ` ezkcdude
@ 2007-05-08 19:31         ` Michael Bode
  2007-05-08 19:43           ` Michael Bode
  2007-05-08 20:02         ` Dmitry A. Kazakov
  2007-05-08 21:21         ` Markus E Leypold
  2 siblings, 1 reply; 47+ messages in thread
From: Michael Bode @ 2007-05-08 19:31 UTC (permalink / raw)


ezkcdude <zamir.evan@gmail.com> writes:

> The only issue that still bugs me is that most of the hardware drivers
> for the major microscope manufacturers (Leica, Nikon, Olympus, Zeiss)
> are in C/C++, so there will still be a need to interface Ada/C/C++ to
> some extent.

That's not a big problem. Usually these libs have tons and tons of
functions of which you need only a handful in your app. Writing an Ada
binding for these is easy. Don't try to bind the whole lib if you
don't need it.

-- 
No intelligent man has any respect for an unjust law. 
He simply follows the eleventh commandment.
-- R.A. Heinlein



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 19:31         ` Michael Bode
@ 2007-05-08 19:43           ` Michael Bode
  0 siblings, 0 replies; 47+ messages in thread
From: Michael Bode @ 2007-05-08 19:43 UTC (permalink / raw)


Michael Bode <m.g.bode@web.de> writes:

> That's not a big problem. Usually these libs have tons and tons of
> functions of which you need only a handful in your app. Writing an Ada
> binding for these is easy. 

I forgot to mention you will encounter funny things in these libs from
our C friends like 'unsigned int func()' which return negative values
as error codes or functions like func(char* c) which write to the
character array *c without any implied or explicit knowledge about the
buffer size. 

-- 
No intelligent man has any respect for an unjust law. 
He simply follows the eleventh commandment.
-- R.A. Heinlein



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 18:51       ` ezkcdude
  2007-05-08 19:31         ` Michael Bode
@ 2007-05-08 20:02         ` Dmitry A. Kazakov
  2007-05-08 21:26           ` Markus E Leypold
  2007-05-08 21:21         ` Markus E Leypold
  2 siblings, 1 reply; 47+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-08 20:02 UTC (permalink / raw)


On 8 May 2007 11:51:53 -0700, ezkcdude wrote:

> All helpful responses. Thanks. One idea that now makes some sense
> (having thought about it for all of a couple of hours), is that the
> GUI/interface could be a separate application that simply sets up the
> experiment (i.e. microscope configuration). For example, creating an
> XML document with appropriate hardware parameters, and then feeding
> this document to the "engine", which actually controls the microscope.

What for? If the parameter dialogs is the only GUI you need, you can
accomplish that in practically any GUI library in two days.

> The GUI could then be written using something even more high-level
> (like my favorite language MATLAB!).

You can call Ada from Matlab, same as you would call C. But, Matlab is not
GPL, it is rather a lot of money. And it is extremely slow. (For our
customers we often design hardware-in-the-loop systems with Matlab/Simulink
mounted on the system's top. Of course the engine is not Matlab, as you
suggested, otherwise it would never work. But the only reason why Matlab is
used, is not fancy GUI, but modeling our customers (mechanical engineers)
wanted to do in Simulink. These are open-end systems. It does not look like
your case.)

> The engine could be written in
> Ada. I could also write another application that would graphically
> monitor the ongoing experiment (i.e. display images).  This monitor
> could be web based, and simply interact with the data that is acquired
> by the microscope controller engine.

Simply interact means what? I bet a subprogram call is the simplest thing
one can imagine. A separate GUI process would mean some communication
middleman between the data acquisition/control engine and the GUI. TCP/IP
sockets, RPC, OPC? And all this just in order to display an image, a couple
of buttons and combo boxes? It looks like an architectural mess. From what
you have described, GUI is about half man-week programming in GtkAda.

> The only issue that still bugs me is that most of the hardware drivers
> for the major microscope manufacturers (Leica, Nikon, Olympus, Zeiss)
> are in C/C++, so there will still be a need to interface Ada/C/C++ to
> some extent.

I would not consider it as a problem at all. The real problem with hardware
interface libraries from third firms is that they are *normally*
non-portable, non-functioning and have documentation describing something
quite different from what you get. Add here, that the devices are customary
malfunctioning. If you send the command A followed by B, the device
software crashes. When you make a full-duplex communication, it crashes
again. When A is sent more frequently than each 100ms it crashes once more,
and so on and so forth. Usually GUI is your least problem.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 18:20         ` Ludovic Brenta
@ 2007-05-08 21:17           ` Markus E Leypold
  0 siblings, 0 replies; 47+ messages in thread
From: Markus E Leypold @ 2007-05-08 21:17 UTC (permalink / raw)



Ludovic Brenta <ludovic@ludovic-brenta.org> writes:


> http://www.ada-france.org:8081/branch/changes/org.ludovic-brenta.meyse
>
> (the licese is PURE GPL, sorry Markus :)).  You'll notice that the

It's an example, so that's pretty much OK. I'm not allergic against
GPL, generally :-). I think I've made all my points concernung GPL on
libraries and sneaky-ways-to-use-GPL-as-viral-poison when applying it
to language run times. It's not the GPL that bothers me, but the way
it's used as a weapon to force a market by some people.

> "engine" and GUI are in separate packages, and the program runs
> equally well on the command line as with a GUI (i.e. with a command
> line parameter, it doesn't start the GUI).
>

Regards -- Markus




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 18:51       ` ezkcdude
  2007-05-08 19:31         ` Michael Bode
  2007-05-08 20:02         ` Dmitry A. Kazakov
@ 2007-05-08 21:21         ` Markus E Leypold
  2007-05-08 21:27           ` ezkcdude
  2 siblings, 1 reply; 47+ messages in thread
From: Markus E Leypold @ 2007-05-08 21:21 UTC (permalink / raw)



ezkcdude <zamir.evan@gmail.com> writes:

> All helpful responses. Thanks. One idea that now makes some sense
> (having thought about it for all of a couple of hours), is that the
> GUI/interface could be a separate application that simply sets up the
> experiment (i.e. microscope configuration). For example, creating an
> XML document with appropriate hardware parameters, and then feeding
> this document to the "engine", which actually controls the microscope.

Don't use XML for that. Overkill. Just plain old tagged data lines

   param1  2342.2423
   param2  32423.234

or even a 1-line per call

   CALL function_name 1212 123123 123 1112

will suffice and be more readable. Imap uses lispish lists as interface.

Regards -- Markus




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 20:02         ` Dmitry A. Kazakov
@ 2007-05-08 21:26           ` Markus E Leypold
  0 siblings, 0 replies; 47+ messages in thread
From: Markus E Leypold @ 2007-05-08 21:26 UTC (permalink / raw)



> I would not consider it as a problem at all. The real problem with hardware
> interface libraries from third firms is that they are *normally*
> non-portable, non-functioning and have documentation describing something
> quite different from what you get. Add here, that the devices are customary
> malfunctioning. If you send the command A followed by B, the device
> software crashes. When you make a full-duplex communication, it crashes
> again. When A is sent more frequently than each 100ms it crashes once more,
> and so on and so forth. Usually GUI is your least problem.

Your organisation seems to have a problem with enforcing vendor
liability. If I pay for a scientific instrument and the only
documented way to interface with it is a vendor supplied C library,
this would better not crash to often.

Regards -- Markus




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 21:21         ` Markus E Leypold
@ 2007-05-08 21:27           ` ezkcdude
  2007-05-08 21:56             ` Markus E Leypold
  0 siblings, 1 reply; 47+ messages in thread
From: ezkcdude @ 2007-05-08 21:27 UTC (permalink / raw)


On May 8, 4:21 pm, Markus E Leypold
<development-2006-8ecbb5cc8aREMOVET...@ANDTHATm-e-leypold.de> wrote:
> ezkcdude <zamir.e...@gmail.com> writes:
> > All helpful responses. Thanks. One idea that now makes some sense
> > (having thought about it for all of a couple of hours), is that the
> > GUI/interface could be a separate application that simply sets up the
> > experiment (i.e. microscope configuration). For example, creating an
> > XML document with appropriate hardware parameters, and then feeding
> > this document to the "engine", which actually controls the microscope.
>
> Don't use XML for that. Overkill. Just plain old tagged data lines
>
>    param1  2342.2423
>    param2  32423.234
>
> or even a 1-line per call
>
>    CALL function_name 1212 123123 123 1112
>
> will suffice and be more readable. Imap uses lispish lists as interface.
>
> Regards -- Markus

Well, maybe if I explain the experiment better, it will make more
sense, why I can't do this so simply. Basically, we do time-lapse
imaging of several (living) specimens (usually quail embryos, but
could also be cell culture) over the course of a few hours to days.
For each specimen, there are several illumination modes (brightfield +
1 or more fluorescence channels). On top of  that the microscope stage
is moved to several overlapping "tiles" for each specimen, so a
widefield montage can be later stitched together in post-processing.
Finally, we capture several slices in the z-direction, which can be
collapsed according to a focus score (sort of like an auto-focus
routine). Again, that can be done in post-processing. Anyway, to
illustrate, here is a typical example:

Experiment:
6 embryos
2x4 tiles
7 z-planes
3 illumination modes
12 minutes/frame (5 frames/h)

Each grayscale image that is acquired is about 635K, so for one 12-
hour experiment, we're acquiring 6*8*7*3*5*12*635K~38GB!

And I need to mention that the embryos do not simply stay put, they
can move around enough that periodic adjustments to the microscope
must be made. That is why it is so important to have some graphical
feedback. I must be able to make sure the embyro is positioned
correctly, and this will obviously vary from embryo-to-embryo and
between experiments. Well, if that still sounds easy to you...




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 21:27           ` ezkcdude
@ 2007-05-08 21:56             ` Markus E Leypold
  2007-05-09 13:25               ` Jacob Sparre Andersen
  0 siblings, 1 reply; 47+ messages in thread
From: Markus E Leypold @ 2007-05-08 21:56 UTC (permalink / raw)



ezkcdude <zamir.evan@gmail.com> writes:

> On May 8, 4:21 pm, Markus E Leypold
> <development-2006-8ecbb5cc8aREMOVET...@ANDTHATm-e-leypold.de> wrote:
>> ezkcdude <zamir.e...@gmail.com> writes:
>> > All helpful responses. Thanks. One idea that now makes some sense
>> > (having thought about it for all of a couple of hours), is that the
>> > GUI/interface could be a separate application that simply sets up the
>> > experiment (i.e. microscope configuration). For example, creating an
>> > XML document with appropriate hardware parameters, and then feeding
>> > this document to the "engine", which actually controls the microscope.
>>
>> Don't use XML for that. Overkill. Just plain old tagged data lines
>>
>>    param1  2342.2423
>>    param2  32423.234
>>
>> or even a 1-line per call
>>
>>    CALL function_name 1212 123123 123 1112
>>
>> will suffice and be more readable. Imap uses lispish lists as interface.
>>
>> Regards -- Markus
>
> Well, maybe if I explain the experiment better, it will make more
> sense, why I can't do this so simply. Basically, we do time-lapse
> imaging of several (living) specimens (usually quail embryos, but
> could also be cell culture) over the course of a few hours to days.
> For each specimen, there are several illumination modes (brightfield +
> 1 or more fluorescence channels). On top of  that the microscope stage
> is moved to several overlapping "tiles" for each specimen, so a
> widefield montage can be later stitched together in post-processing.
> Finally, we capture several slices in the z-direction, which can be
> collapsed according to a focus score (sort of like an auto-focus
> routine). Again, that can be done in post-processing. Anyway, to
> illustrate, here is a typical example:
>
> Experiment:
> 6 embryos
> 2x4 tiles
> 7 z-planes
> 3 illumination modes
> 12 minutes/frame (5 frames/h)
>
> Each grayscale image that is acquired is about 635K, so for one 12-
> hour experiment, we're acquiring 6*8*7*3*5*12*635K~38GB!
>
> And I need to mention that the embryos do not simply stay put, they
> can move around enough that periodic adjustments to the microscope
> must be made. That is why it is so important to have some graphical
> feedback. I must be able to make sure the embyro is positioned
> correctly, and this will obviously vary from embryo-to-embryo and
> between experiments. Well, if that still sounds easy to you...

Just think RPC and choose a suitable data format for your protocol.
Calling a "remote" function would just be writing a record in a given
format and waiting for an answering record.

I doubt XML will give you much benefit there, esp. with pcitures.

Concerning pictures: I suggest you write them into a picture queue in
the filesystem and don't pass them through the RPC interface. What you
pass through the interface would just be the file names. If your GUI
or tools want to manipulate images (i.e. removing them while encoding
them to another format), you need a protocol so that different tools
can operate on the image store, i.e. some way to lock the store and
make changes in it known to all participants. Recently I've been
playing with the idea to use the maildir protocol for something like
this, because it mostly eliminates the necessity of locking.

Regards -- Markus





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 21:56             ` Markus E Leypold
@ 2007-05-09 13:25               ` Jacob Sparre Andersen
  2007-05-09 15:58                 ` Markus E Leypold
  0 siblings, 1 reply; 47+ messages in thread
From: Jacob Sparre Andersen @ 2007-05-09 13:25 UTC (permalink / raw)


Markus E Leypold wrote:

> Concerning pictures: I suggest you write them into a picture queue
> in the filesystem and don't pass them through the RPC
> interface. What you pass through the interface would just be the
> file names.

File names are slow.  Wouldn't it be more appropriate to keep the
currently relevant image(s) in a shared memory segment?

Jacob
-- 
"[...] *transfer* a bit of salary from the person who writes
 a bug to the person that finds a bug..." -- Keith Ray



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-09 13:25               ` Jacob Sparre Andersen
@ 2007-05-09 15:58                 ` Markus E Leypold
  2007-05-10 21:20                   ` Memory mapped files and shared memory (Was: Newbie Needs Ada Advice) Jacob Sparre Andersen
  0 siblings, 1 reply; 47+ messages in thread
From: Markus E Leypold @ 2007-05-09 15:58 UTC (permalink / raw)



Jacob Sparre Andersen <sparre@nbi.dk> writes:

> Markus E Leypold wrote:
>
>> Concerning pictures: I suggest you write them into a picture queue
>> in the filesystem and don't pass them through the RPC
>> interface. What you pass through the interface would just be the
>> file names.
>
> File names are slow.  Wouldn't it be more appropriate to keep the
> currently relevant image(s) in a shared memory segment?

Dependents on what you want to do. Probably not the whole 30 GB. My
rule of thumb always is to do the elementary thing first and optimize
later. In this case one could use the file storage (one use it
anyway), introduce (when required) the shared memory for explicit
caching (or perhaps play with memory mapping the file) and refine the
get-the-image protocol appropriately. My gut feeling though is, to
trust the file system cache of the machine to do the proper caching
implicitely and there should be a good reason to think you can do
better than that manually.

Regards -- Markus




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 14:40   ` ezkcdude
                       ` (2 preceding siblings ...)
  2007-05-08 18:28     ` Alex R. Mosteo
@ 2007-05-10 18:14     ` Chip and Allie Orange
  2007-05-27  5:50     ` adaworks
  4 siblings, 0 replies; 47+ messages in thread
From: Chip and Allie Orange @ 2007-05-10 18:14 UTC (permalink / raw)



"ezkcdude" <zamir.evan@gmail.com> wrote in message 
news:1178635220.859690.3310@y80g2000hsf.googlegroups.com...
> Markus, thanks for the advice. I'm one of those people who loves to do
> the "right" thing, and it seems to me like Ada is, in theory, a great
> programming language. Of course, one has to be practical. The main
> issues that I am trying to wrestle with is how I would implement a GUI
> and, in general, handle graphics (display, manipulation, input/
> output). Java seems much more ready-made for these tasks at the
> moment, and I don't see the Ada packages have that much enthusiasm or
> support. It's unfortunate, because like I said, Ada seems like the
> "right" language to me for most of what my objectives are.
>
> One idea I have, and I'd love to hear advice or comments, is to use
> Ada as the "engine" for my program, and somehow use Java to create the
> GUI and deal with images. Does this seem like a possibility?
> -evan
>


I can't remember your development host requirements, but if it's only 
Windows, you've always got the option of using A#, and therefore all the 
visual studio GUI capabilities.

I'm in a similar position to you; being a newbie to Ada I'm about to start 
my own first large Ada project, and I think A# is what I'll try first.  Not 
for GUI reasons, but because of it's availability of some development tools 
specific to my project.

If I had a need for a platform-independent GUI, I'd certainly choose HTML 
(via AWS) over Java.

HTH,

Chip






^ permalink raw reply	[flat|nested] 47+ messages in thread

* Memory mapped files and shared memory (Was: Newbie Needs Ada Advice)
  2007-05-09 15:58                 ` Markus E Leypold
@ 2007-05-10 21:20                   ` Jacob Sparre Andersen
  2007-05-11 16:38                     ` ezkcdude
  0 siblings, 1 reply; 47+ messages in thread
From: Jacob Sparre Andersen @ 2007-05-10 21:20 UTC (permalink / raw)


Markus E Leypold wrote:
> Jacob Sparre Andersen <sparre@nbi.dk> writes:

>> File names are slow.  Wouldn't it be more appropriate to keep the
>> currently relevant image(s) in a shared memory segment?
>
> Dependents on what you want to do. Probably not the whole 30 GB. My
> rule of thumb always is to do the elementary thing first and
> optimize later.

In general that is also what I do, but isn't it simpler to store the
whole sequence of images in an array of images?  Mapping that array
into a file/shared memory segment costs you around 20 lines of code
(even with my rather extravagant use of linebreaks).

There is one catch: I am not sure that the Ada interface to POSIX
systems is required to support memory maps as large as 30 Gb.
(Additionally I suspect that the original poster isn't using a POSIX
system.)

> In this case one could use the file storage (one use it anyway),
> introduce (when required) the shared memory for explicit caching (or
> perhaps play with memory mapping the file) and refine the
> get-the-image protocol appropriately. My gut feeling though is, to
> trust the file system cache of the machine to do the proper caching
> implicitely and there should be a good reason to think you can do
> better than that manually.

Using memory maps goes even further in leaving the caching/swapping
decisions to the operating systems, than copying individual images to
and from files.

Greetings,

Jacob
-- 
recursive, adj.; see recursive



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Memory mapped files and shared memory (Was: Newbie Needs Ada Advice)
  2007-05-10 21:20                   ` Memory mapped files and shared memory (Was: Newbie Needs Ada Advice) Jacob Sparre Andersen
@ 2007-05-11 16:38                     ` ezkcdude
  0 siblings, 0 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-11 16:38 UTC (permalink / raw)


On May 10, 4:20 pm, Jacob Sparre Andersen <spa...@nbi.dk> wrote:
> Markus E Leypold wrote:
> > Jacob Sparre Andersen <spa...@nbi.dk> writes:
> >> File names are slow.  Wouldn't it be more appropriate to keep the
> >> currently relevant image(s) in a shared memory segment?
>
> > Dependents on what you want to do. Probably not the whole 30 GB. My
> > rule of thumb always is to do the elementary thing first and
> > optimize later.
>
> In general that is also what I do, but isn't it simpler to store the
> whole sequence of images in an array of images?  Mapping that array
> into a file/shared memory segment costs you around 20 lines of code
> (even with my rather extravagant use of linebreaks).
>
> There is one catch: I am not sure that the Ada interface to POSIX
> systems is required to support memory maps as large as 30 Gb.
> (Additionally I suspect that the original poster isn't using a POSIX
> system.)
>
> > In this case one could use the file storage (one use it anyway),
> > introduce (when required) the shared memory for explicit caching (or
> > perhaps play with memory mapping the file) and refine the
> > get-the-image protocol appropriately. My gut feeling though is, to
> > trust the file system cache of the machine to do the proper caching
> > implicitely and there should be a good reason to think you can do
> > better than that manually.
>
> Using memory maps goes even further in leaving the caching/swapping
> decisions to the operating systems, than copying individual images to
> and from files.
>
> Greetings,
>
> Jacob
> --
> recursive, adj.; see recursive

So, what's the bottom line? If my application needs to write images as
fast as possible to disk, how should one go about doing that? And is
Ada as good as any other low-level programming language for this task?

On a related topic, would it be helpful to have very fast hard drives
in a RAID 0 configuration? I'm wondering if that would automatically
speed up things, or would I have to somehow take advantage of that in
the Ada program...




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-08 14:40   ` ezkcdude
                       ` (3 preceding siblings ...)
  2007-05-10 18:14     ` Newbie Needs Ada Advice Chip and Allie Orange
@ 2007-05-27  5:50     ` adaworks
  2007-05-29 12:54       ` ezkcdude
  4 siblings, 1 reply; 47+ messages in thread
From: adaworks @ 2007-05-27  5:50 UTC (permalink / raw)



"ezkcdude" <zamir.evan@gmail.com> wrote in message 
news:1178635220.859690.3310@y80g2000hsf.googlegroups.com...
>
> One idea I have, and I'd love to hear advice or comments, is to use
> Ada as the "engine" for my program, and somehow use Java to create the
> GUI and deal with images. Does this seem like a possibility?
> -evan
>
I learned recently that AdaCore is planning a resurrected modification
of JGNAT that will allow Ada to interface to JNI libraries.  If this
works, it should allow you to do what you just described.

Richard Riehle 





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Newbie Needs Ada Advice
  2007-05-27  5:50     ` adaworks
@ 2007-05-29 12:54       ` ezkcdude
  0 siblings, 0 replies; 47+ messages in thread
From: ezkcdude @ 2007-05-29 12:54 UTC (permalink / raw)


On May 27, 12:50 am, <adawo...@sbcglobal.net> wrote:
> "ezkcdude" <zamir.e...@gmail.com> wrote in message
>
> news:1178635220.859690.3310@y80g2000hsf.googlegroups.com...
>
> > One idea I have, and I'd love to hear advice or comments, is to use
> > Ada as the "engine" for my program, and somehow use Java to create the
> > GUI and deal with images. Does this seem like a possibility?
> > -evan
>
> I learned recently that AdaCore is planning a resurrected modification
> of JGNAT that will allow Ada to interface to JNI libraries.  If this
> works, it should allow you to do what you just described.
>
> Richard Riehle

Thanks! I'll keep an eye out for that.




^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2007-05-29 12:54 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
2007-05-03 18:24 ` Dmitry A. Kazakov
2007-05-03 22:14   ` ezkcdude
2007-05-04  4:07 ` tmoran
2007-05-04 12:57   ` Bob Spooner
2007-05-04 13:38     ` Dmitry A. Kazakov
2007-05-04 14:40       ` ezkcdude
2007-05-04 19:19       ` Bob Spooner
2007-05-04 19:48         ` Dmitry A. Kazakov
2007-05-06 21:46           ` ezkcdude
2007-05-07  7:31             ` Dmitry A. Kazakov
2007-05-07  7:42             ` Alex R. Mosteo
2007-05-07  9:15               ` Dmitry A. Kazakov
2007-05-08  2:58             ` Justin Gombos
2007-05-08 11:58               ` ezkcdude
2007-05-04  4:42 ` Jeffrey R. Carter
2007-05-04  6:48 ` Jacob Sparre Andersen
2007-05-07  8:01 ` Markus E Leypold
2007-05-08 14:40   ` ezkcdude
2007-05-08 15:07     ` Pascal Obry
2007-05-08 15:27       ` ezkcdude
2007-05-08 15:54         ` Pascal Obry
2007-05-08 16:07         ` Georg Bauhaus
2007-05-08 18:42           ` Markus E Leypold
2007-05-08 16:18         ` Ali Bendriss
2007-05-08 19:23         ` Michael Bode
2007-05-08 16:11     ` Markus E Leypold
2007-05-08 16:49       ` ezkcdude
2007-05-08 18:20         ` Ludovic Brenta
2007-05-08 21:17           ` Markus E Leypold
2007-05-08 18:45         ` Markus E Leypold
2007-05-08 18:28     ` Alex R. Mosteo
2007-05-08 18:51       ` ezkcdude
2007-05-08 19:31         ` Michael Bode
2007-05-08 19:43           ` Michael Bode
2007-05-08 20:02         ` Dmitry A. Kazakov
2007-05-08 21:26           ` Markus E Leypold
2007-05-08 21:21         ` Markus E Leypold
2007-05-08 21:27           ` ezkcdude
2007-05-08 21:56             ` Markus E Leypold
2007-05-09 13:25               ` Jacob Sparre Andersen
2007-05-09 15:58                 ` Markus E Leypold
2007-05-10 21:20                   ` Memory mapped files and shared memory (Was: Newbie Needs Ada Advice) Jacob Sparre Andersen
2007-05-11 16:38                     ` ezkcdude
2007-05-10 18:14     ` Newbie Needs Ada Advice Chip and Allie Orange
2007-05-27  5:50     ` adaworks
2007-05-29 12:54       ` ezkcdude

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox