Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread aitor_czr

It was not Pascal the successor of Modula?

El 12/09/15 a las 22:38,  Hendrik Boom  escribió:


Modula 3 isn't dead.  Moribund, maybe, but not dead.  And it easily
beats a number of madly popular languages for systems programming.
Its one of the few languages I've used in which large programs often
(but certainly not always) run correctly the first time they get through
the compiler.

There is a .deb for Modula 3 available for download, but it's not part
of Debian as far as I know.


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2015 at 08:38:40PM +, Jonathan Wilkes wrote:
> It depends completely on the random guy. :)
> If you were a knowledgeable advocate of Guile and saw the same risks of 
> "winging it" with C strings, then there'd now be at least two devs with a 
> vested interest in a port of the relevant functionality.

All the languages I mentioned -- Modula 3, OCaml, and Guile (as a  
Scheme dialect that interfaces well with C) would be better than C if 
your purpose is a lot of string handling.

OCaml and Guile are already present in Debian, so they have a natural 
advantage.

OCaml is stically types, which catches bugs fast

Guile is a GNU language, which may have some political 
advantages.

-- hendrik

> 
> Instead, I agree with the essence of your response.
> 
> -Jonathan
> 
> 
> 
> 
>  On Saturday, September 12, 2015 2:26 PM, tilt!  wrote:
>
> 
>  Hi Jonathan,
> 
> no please! I was kidding, as indicated by smileys interleaved with my
> postings!  :-D
> 
> BTW if you have the time to do it, and if you think it brings you
> something, why should a random guy from the internet like i be the one
> who gives thumbs up or down?
> 
> Should it be your serious intention to present a replacement for the
> existing "netman" backend executable that is completely written in a
> language i came up with on a whim, by Googeling for LISP dialects,
> chances are that it will not be considered.
> 
> In any case, Ennius writes:
> 
> Otio qui nescit uti
> plus negoti habet quam cum est negotium in negotio.
> 
> He who does not know how to use leisure
> has more of work than when there is work in work.
> 
> Best regards,
> T.
> 
> On 09/12/2015 07:39 PM, Jonathan Wilkes wrote:
>  > Guile it is.
> > Just so we're clear-- I am  assuming you understand why I want to do
>  > this, and that you will defend the choice of language against
>  > bike-shedders and Socratic bombers.  (Though of course you don't have
>  > to defend my actual code.)  If both those assumptions are true then
>  > I'll get started.
>  > -Jonathan
>  > On Saturday, September 12, 2015 12:43 PM, tilt!  wrote:
>  > Hi Jonathan,
>  >
>  > On 09/12/2015 06:04 PM, Jonathan Wilkes wrote:
>  > > Hi tilt!
>  > > Is this a serious response?  I ask because the other candidates
>  > > -- an obscure language and a dead language-- were not.
>  > >
>  > > If so tell me which dialect to use.
>  >
>  > No, it's *not* a serious response.  Had i been serious, i had
>  > requested Guile. ;-)
>  >
>  > Best regards,
>  > T.
> 
> 
> 
>   

> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread tilt!

Hi Jonathan,

no please! I was kidding, as indicated by smileys interleaved with my
postings!  :-D

BTW if you have the time to do it, and if you think it brings you
something, why should a random guy from the internet like i be the one
who gives thumbs up or down?

Should it be your serious intention to present a replacement for the
existing "netman" backend executable that is completely written in a
language i came up with on a whim, by Googeling for LISP dialects,
chances are that it will not be considered.

In any case, Ennius writes:

Otio qui nescit uti
plus negoti habet quam cum est negotium in negotio.

He who does not know how to use leisure
has more of work than when there is work in work.

Best regards,
T.

On 09/12/2015 07:39 PM, Jonathan Wilkes wrote:
> Guile it is.

Just so we're clear-- I am  assuming you understand why I want to do

> this, and that you will defend the choice of language against
> bike-shedders and Socratic bombers.  (Though of course you don't have
> to defend my actual code.)  If both those assumptions are true then
> I'll get started.
> -Jonathan
> On Saturday, September 12, 2015 12:43 PM, tilt!  wrote:
> Hi Jonathan,
>
> On 09/12/2015 06:04 PM, Jonathan Wilkes wrote:
> > Hi tilt!
> > Is this a serious response?  I ask because the other candidates
> > -- an obscure language and a dead language-- were not.
> >
> > If so tell me which dialect to use.
>
> No, it's *not* a serious response.  Had i been serious, i had
> requested Guile. ;-)
>
> Best regards,
> T.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Jonathan Wilkes
Guile it is.
Just so we're clear-- I am assuming you understand why I want to do this, and 
that you will defend the choice of language against bike-shedders and Socratic 
bombers.  (Though of course you don't have to defend my actual code.)  If both 
those assumptions are true then I'll get started.

-Jonathan
 



 On Saturday, September 12, 2015 12:43 PM, tilt!  wrote:
   

 Hi Jonathan,

On 09/12/2015 06:04 PM, Jonathan Wilkes wrote:
> Hi tilt!
> Is this a serious response?  I ask because the other candidates
> -- an obscure language and a dead language-- were not.
>
> If so tell me which dialect to use.

No, it's *not* a serious response.  Had i been serious, i had
requested Guile. ;-)

Best regards,
T.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


  ___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread tilt!

Hi Jonathan,

On 09/12/2015 06:04 PM, Jonathan Wilkes wrote:

Hi tilt!
Is this a serious response?  I ask because the other candidates
-- an obscure language and a dead language-- were not.

If so tell me which dialect to use.


No, it's *not* a serious response.  Had i been serious, i had
requested Guile. ;-)

Best regards,
T.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2015 at 04:04:14PM +, Jonathan Wilkes wrote:
> Hi tilt!Is this a serious response?  I ask because the other 
> candidates-- an obscure language and a dead language-- were not.


Programming language popularity is more a matter of fashion than 
technical excellence.



Modula 3 isn't dead.  Moribund, maybe, but not dead.  And it easily 
beats a number of madly popular languages for systems programming. 
Its one of the few languages I've used in which large programs often 
(but certainly not always) run correctly the first time they get through 
the compiler.

There is a .deb for Modula 3 available for download, but it's not part 
of Debian as far as I know.



Ocaml is very much alive.  It originated in the formal verification and 
proof-checking community, which very much wants to avoid accepting 
invalid formal proofs because of program bugs.

It is now suitable for a variety of applications.  It is maintained by 
its users, as is much free software, and mostly by Jane Street.  They 
are some kind of financial services company, and they seem to consider that 
it gives them enough of a competitive edge that they actively work on 
its maintenance.  They actively recruit Lisp and OCaml programmers.

For systems work, there are bindins available to a lot of the usual C 
libraries, and it's normal to make more. 

OCaml is available in Debian and willl be available in Devuan again when 
the repositories are fixed.



Of the Lisp dialects, I'd recommend implementations of Scheme.  Here 
things get a bit messy.  There are a lot of them, and each of them 
differs significantly in terms of what extra features  they provided 
above and beyond the standard.  If you look at Scheme, I'd suggest: 
* Racket, which is a serious language that has been used, for example, 
to implement a web server. 
* Guile, which is the official scripting extension language for GNU,
* Gambit, which is compiled to C, and has extensions to make interfacing 
with C easy.

Racket is available in Debian too, and I'd be surprised if it depended 
on systemd.

Guile is probably as available, because it is a GNU project.  It is made 
to be linked with C code, so you can write your program in Scheme while 
the dirty bits are offloaded to C.
 

> 
> If so tell me which dialect to use.
> -Jonathan

Of these, I think Modula 3 is techincally most suited to the task,  and 
OCaml is most likely to be compatibly avilabl into the future.

Scheme is a mature language with excellent survivablility, 
but it changes a lot, and comes in too many dialects.
It may not be what you want.  But it is a foundatonal language, and one 
you should be familiar with no matter what language you actually use.
Racket is probably the easiest dialect to get into, because there are 
some excellent introductory textbooks.

-- hendrik


> 
>  
> 
> 
>  On Saturday, September 12, 2015 11:30 AM, tilt!  wrote:
>
> 
>  On 09/11/2015 08:57 PM, Jonathan Wilkes wrote:
>  > [...]
> > To anyone else mortified by this thread: name any of the obviously
> > preferable languages for this job and I'll try my hand at porting to
> > that language. I can't guarantee I'll know exactly what I'm doing,
> > but I can guarantee that an entire class of potential bugs will
> > magically disappear in whatever I end up with.
> 
> Do it in LISP! It's perfect for list processing! :D
> 
> Best regards,
> T.
> 
> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
> 
> 
>   

> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2015 at 05:30:23PM +0200, tilt! wrote:
> On 09/11/2015 08:57 PM, Jonathan Wilkes wrote:
> > [...]
> >To anyone else mortified by this thread: name any of the obviously
> >preferable languages for this job and I'll try my hand at porting to
> >that language. I can't guarantee I'll know exactly what I'm doing,
> >but I can guarantee that an entire class of potential bugs will
> >magically disappear in whatever I end up with.
> 
> Do it in LISP! It's perfect for list processing! :D

So, actually is OCaml.  But OCaml is statically typed.

Ah yes.  There's a Lisp dialect, Racket, with a version called Typed Racket.
Thats Scheme with static types.

-- hendrik

> 
> Best regards,
> T.
> 
> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2015 at 03:42:47PM +0200, a...@gulbrandsen.priv.no wrote:
> M3 was great. Maybe the language I like best among the compiled
> ones. For example, the specification is just fifty and a half pages
> long, and it has 31-bit unsigned integers instead of 32.

I still use it.

It's still a decent language, with features specific to systems implementation.

> 
> But don't use it. It is dead. No toolchain update in quite a few
> years any more, and the book is out of print. (Yes, I have a copy
> and I am keeping it.)

Not quite dead.

The developers are currently putting together the pieces for the next 
major release.

It will have a code generator that generates C as well as th eusual 
native code generators.

> 
> Arnt


But now, for something completely different.

Try OCaml.  There's a lot of networking software written in it, as it 
happens, including, IIRC, the entire OCaml website. 

The language is 20 years mature.  I say mature rather than old, because 
it hasn't been sitting still all those years.  It's still under active 
design aand development.

The bindings for various Unixy system libraries are done via a C 
interface.  It can be tricky for a beginner to implement a new one.  But 
it allready has tools for reading ane writing files, directories, etc.
Which might be what you need?

There is a steep learning curve.

And the language steald one bit out of every integer (so you end up with 
31-bit integers and 63-bit integers on what would otherwise be 32 and 64 
bit integers on 32 and 64-bit machines.

-- hendrik
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread tilt!

On 09/11/2015 08:57 PM, Jonathan Wilkes wrote:
> [...]

To anyone else mortified by this thread: name any of the obviously
preferable languages for this job and I'll try my hand at porting to
that language. I can't guarantee I'll know exactly what I'm doing,
but I can guarantee that an entire class of potential bugs will
magically disappear in whatever I end up with.


Do it in LISP! It's perfect for list processing! :D

Best regards,
T.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Rainer Weikusat
Hendrik Boom  writes:
> On Fri, Sep 11, 2015 at 06:57:04PM +, Jonathan Wilkes wrote:
>> Wow, we've gone from "I don't understand c strings" to "let me explain them 
>> using matrices".
>> 
>> To anyone else mortified by this thread: name any of the obviously 
>> preferable languages for this job and I'll try my hand at porting to 
>> that language.  I can't guarantee I'll know exactly what I'm doing, 
>> but I can guarantee that an entire class of potential bugs will 
>> magically disappear in whatever I end up with.
>
> To pick an obscure one:

Sorry for hijacking this posting but the one I was planning to reply to
didn't show up on the list:

How about another challenge, Mr Wilkes? "Try your hands at PHP" and
create an entirely new 'class of real, ie not potential' programming
errors with dreadful and seriously expensive consequences: SQL
injection. That's what one gets when wrongly assuming that the tools are
to blame for the errors the fools make when trying to use them.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread arnt
M3 was great. Maybe the language I like best among the compiled ones. 
For example, the specification is just fifty and a half pages long, and 
it has 31-bit unsigned integers instead of 32.


But don't use it. It is 
dead. No toolchain update in quite a few years any more, and the book 
is out of print. (Yes, I have a copy and I am keeping it.)


Arnt
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Hendrik Boom
On Fri, Sep 11, 2015 at 06:57:04PM +, Jonathan Wilkes wrote:
> Wow, we've gone from "I don't understand c strings" to "let me explain them 
> using matrices".
> 
> To anyone else mortified by this thread: name any of the obviously 
> preferable languages for this job and I'll try my hand at porting to 
> that language.  I can't guarantee I'll know exactly what I'm doing, 
> but I can guarantee that an entire class of potential bugs will 
> magically disappear in whatever I end up with.

To pick an obscure one:

Modula 3, a strongly statically typed language in which an operating 
system was once written.

(Its a completely different language from Modula 2.)

-- hendrik
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread aitor_czr

I have a goog friend : Sherlock Holmes.

On 12/09/15 08:58, KatolaZ wrote:

On Sat, Sep 12, 2015 at 03:50:57AM +0200, aitor_czr wrote:

>I recomend you to eat a pizza with Jaromil
>

:)  How do you know I have not had a pizza with Jaromil already?

HND

KatolaZ


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread Svante Signell
On Fri, 2015-09-11 at 22:34 +0200, aitor_czr wrote:
> You are right Edward, i was thinking in the transposition matrix. 
> 
> > El 11/09/15 a las 19:32, Edward Bartolo escribió: 
> > 
> > 
> > > only square matrices can
> > > have an inverse

If a square matrix is singular, i.e. the determinant is zero, no inverse
exists (a pseudoinverse and SVD exists though, see below).

For non-square, and square, matrices you can always define a
pseudo-inverse, (Moore-Penrose pseudoinverse), as well as calculate the
Singular Value Decomposition (SVD). The SVD is an efficient way to
calculate the pseudoinverse and least-squares fitting of data.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-12 Thread KatolaZ
On Sat, Sep 12, 2015 at 03:50:57AM +0200, aitor_czr wrote:
> I recomend you to eat a pizza with Jaromil
> 

:) How do you know I have not had a pizza with Jaromil already? 

HND

KatolaZ

-- 
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

Of course... and Maxwell.. and many others...

El 11/09/15 a las 23:18, Peter Olson escribió:

On September 11, 2015 at 2:24 PM aitor_czr  wrote:
>
>No!
>
>Only square matrices can have a determinant.
>
>I am not Roger Penrose. I am a hooligan of*Richard Feynman*
>and*Lev Davidovick Landau*  (vintage).

Perhaps also with some variation*Joseph-Louis Lagrange*  :-)

Peter Olson


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

I recomend you to eat a pizza with Jaromil

El 12/09/15 a las 00:18, KatolaZ escribió:

  will become pedantic now, but if A is a matrix, the interpretation
of the equations above depends on what "1" and "/" actually mean for
you. In general, 1/A does not mean anything when you deal with
matrices. The symbol "A^{-1}" is normally used to denote the inverse
of A. And the inverse is defined only for square matrices. Hence your
"conclusion" is actually a fundamental hypothesys to make those
equations mean anything at all:)

HND


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread KatolaZ
On Fri, Sep 11, 2015 at 10:48:19PM +0200, aitor_czr wrote:
> A * (1/A) = 1 = (1/A) * A
> 
> So, it must be square :-)
> 

I will become pedantic now, but if A is a matrix, the interpretation
of the equations above depends on what "1" and "/" actually mean for
you. In general, 1/A does not mean anything when you deal with
matrices. The symbol "A^{-1}" is normally used to denote the inverse
of A. And the inverse is defined only for square matrices. Hence your
"conclusion" is actually a fundamental hypothesys to make those
equations mean anything at all :)

HND

KatolaZ

-- 
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Peter Olson
> On September 11, 2015 at 2:24 PM aitor_czr  wrote:
> 
> No!
> 
> Only square matrices can have a determinant.
> 
> I am not Roger Penrose. I am a hooligan of *Richard Feynman*
> and *Lev Davidovick Landau* (vintage).

Perhaps also with some variation *Joseph-Louis Lagrange* :-)

Peter Olson
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

A * (1/A) = 1 = (1/A) * A

So, it must be square :-)

On 11/09/15 20:57, Jonathan Wilkes wrote:

El 11/09/15 a las 19:32, Edward Bartolo escribió:


only square matrices can
have an inverse


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

You are right Edward, i was thinking in the transposition matrix.


El 11/09/15 a las 19:32, Edward Bartolo escribió:


only square matrices can
have an inverse


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
Hi all,

auto-conn successfully connected to my wifi notwithstanding I had more
than one "interfaces" file installed for the wifis belonging to two
sisters. So, it had to decide which file to use from three "essid"
files.

Internally, it sorts the available wifi signals according to strength
starting from the strongest source. This function was tested
successfully. Nest time, I will do the testing at my sister's home to
actually test the pudding in the eating, and I have a feeling, it will
taste wonderful.

GLib dependency avoided successfully.

Edward.

On 11/09/2015, tilt!  wrote:
> Perfect - avoids the GLIB dependency, too :)
>
> GLIB is a bloated beast anyway, comes with an XML parser, an own
> threading system, i bet somewhere in there is a fully featured telnet
> client and a mail program, too.
>
> Thank you Rainer for extreme (C) programming. ;-)
>
> Regards,
> T.
>
> On 09/11/2015 04:44 PM, Edward Bartolo wrote:
>> I will try the solution from Rainer as it seems to do the least of
>> disruption to my original code.
>>
>> Thanks to you all,
>> Edward
>>
>> On 11/09/2015, Edward Bartolo  wrote:
>>> As suggested by tilt, I switched to use GSList but I need to use it
>>> for two distinct cases:
>>> a) to manage a list of strings
>>> b) to manage a list of structures of this construct:
>>>
>>> typedef struct {
>>> double quality;
>>> char name[MAX_ESSID_LENGTH];
>>> } wifi_quality;
>>>
>>> I expect this to be possible as lists may not always be lists of
>>> strings.
>>>
>>> In the case it is possible to use GSList to manage lists of custom
>>> structures like the above, which function the type of strdup is used
>>> to allocate memory and prepare a structure so that it would be added
>>> to the list?
>>>
>>> I also need to swap two items in the list in a sorting function.
>>>
>>> Edward
>>>
>>> On 11/09/2015, Rainer Weikusat  wrote:
 "tilt!"  writes:
> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
>> Hi all,
>>
>> Since yesterday I have been trying to understand why "char**
>> essid_list" is working inside getInstalledEssidList(&count,
>> essid_list) but failing as soon as I try to access essid_list[0]
>> outside the function.
>>
>> Both the source and the gdb text output are attached.
>>
>> Any helpful pointers are appreciated.
> Having dynamically growing (and shrinking) lists in C is
> always a problem. That's why the problem has been solved
> many times. :-)
>
> For example, the singly-linked list, GSList, from the GLIB
> library is pretty popular and could save you some time.
 JFTR: That part of the code is works.
 ___
 Dng mailing list
 Dng@lists.dyne.org
 https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

>
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread tilt!

Perfect - avoids the GLIB dependency, too :)

GLIB is a bloated beast anyway, comes with an XML parser, an own 
threading system, i bet somewhere in there is a fully featured telnet 
client and a mail program, too.


Thank you Rainer for extreme (C) programming. ;-)

Regards,
T.

On 09/11/2015 04:44 PM, Edward Bartolo wrote:

I will try the solution from Rainer as it seems to do the least of
disruption to my original code.

Thanks to you all,
Edward

On 11/09/2015, Edward Bartolo  wrote:

As suggested by tilt, I switched to use GSList but I need to use it
for two distinct cases:
a) to manage a list of strings
b) to manage a list of structures of this construct:

typedef struct {
double quality;
char name[MAX_ESSID_LENGTH];
} wifi_quality;

I expect this to be possible as lists may not always be lists of strings.

In the case it is possible to use GSList to manage lists of custom
structures like the above, which function the type of strdup is used
to allocate memory and prepare a structure so that it would be added
to the list?

I also need to swap two items in the list in a sorting function.

Edward

On 11/09/2015, Rainer Weikusat  wrote:

"tilt!"  writes:

On 09/11/2015 10:35 AM, Edward Bartolo wrote:

Hi all,

Since yesterday I have been trying to understand why "char**
essid_list" is working inside getInstalledEssidList(&count,
essid_list) but failing as soon as I try to access essid_list[0]
outside the function.

Both the source and the gdb text output are attached.

Any helpful pointers are appreciated.

Having dynamically growing (and shrinking) lists in C is
always a problem. That's why the problem has been solved
many times. :-)

For example, the singly-linked list, GSList, from the GLIB
library is pretty popular and could save you some time.

JFTR: That part of the code is works.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng



___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

No!

Only square matrices can have a determinant.

I am not Roger Penrose. I am a hooligan of *Richard Feynman* and *Lev 
Davidovick Landau* (vintage).


Yes, i know... There are many hooligans in this forum. There is a 
special black hole in the heaven for that guys.


Aitor.

El 11/09/15 a las 19:32, Edward Bartolo escribió:

only square matrices can
have an inverse


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
Hi Aitor,

auto-connect successfully sorted the available wifi signals according
to strength and finally it connected to my wifi. Hurray!

The next test, is to include more wifi interfaces files and test
whether it can select the wifi with the best signal and choose the
corresponding interfaces file. I have the feeling that it will soon be
part of netman.

Thanks for your explanation about an NxM matrix. I am qualified in
mathematics, before somebody else pops in, only square matrices can
have an inverse. Imagine having N linear equations with N unknowns:
the matrix's elements would be the variables' coefficients and the RHS
would be a column matrix with N rows and 1 column.

Edward

On 11/09/2015, aitor_czr  wrote:
> Hi Edward,
>
> Consider a double pointer like a matrix (in algebra) witch one you don't
> know its dimension a priori.
>
> An example: put the case that we are developing an application witch
> calculates the inverse of a matrix of dimensions NxM. The values of N
> and M will be determinated by the user and they are unknown a priori. If
> so, we declare a doble pointer:
>
> float **ptr;
>
> The application asks to the user the values of of the number of files
> (N) and columns (M), and according to them it reserves the "necessary
> and sufficient" memory:
>
> ptr = (float**) malloc(files* sizeof(float*);
>
>for (i=0; i
>ptr[i] = (float*) malloc(columns*sizeof(float));
>
> Once the application has calculated the resulting inverse matrix MxN, we
> must delete the memory *manually*.
>
> Aitor.
>
>
> On 11/09/15 10:35, Edward Bartolo  wrote:
>> Hi all,
>>
>> Since yesterday I have been trying to understand why "char**
>> essid_list" is working inside getInstalledEssidList(&count,
>> essid_list) but failing as soon as I try to access essid_list[0]
>> outside the function.
>>
>> Both the source and the gdb text output are attached.
>>
>> Any helpful pointers are appreciated.
>
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
I will try the solution from Rainer as it seems to do the least of
disruption to my original code.

Thanks to you all,
Edward

On 11/09/2015, Edward Bartolo  wrote:
> As suggested by tilt, I switched to use GSList but I need to use it
> for two distinct cases:
> a) to manage a list of strings
> b) to manage a list of structures of this construct:
>
> typedef struct {
>   double quality;
>   char name[MAX_ESSID_LENGTH];
> } wifi_quality;
>
> I expect this to be possible as lists may not always be lists of strings.
>
> In the case it is possible to use GSList to manage lists of custom
> structures like the above, which function the type of strdup is used
> to allocate memory and prepare a structure so that it would be added
> to the list?
>
> I also need to swap two items in the list in a sorting function.
>
> Edward
>
> On 11/09/2015, Rainer Weikusat  wrote:
>> "tilt!"  writes:
>>> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
 Hi all,

 Since yesterday I have been trying to understand why "char**
 essid_list" is working inside getInstalledEssidList(&count,
 essid_list) but failing as soon as I try to access essid_list[0]
 outside the function.

 Both the source and the gdb text output are attached.

 Any helpful pointers are appreciated.
>>>
>>> Having dynamically growing (and shrinking) lists in C is
>>> always a problem. That's why the problem has been solved
>>> many times. :-)
>>>
>>> For example, the singly-linked list, GSList, from the GLIB
>>> library is pretty popular and could save you some time.
>>
>> JFTR: That part of the code is works.
>> ___
>> Dng mailing list
>> Dng@lists.dyne.org
>> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>>
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
As suggested by tilt, I switched to use GSList but I need to use it
for two distinct cases:
a) to manage a list of strings
b) to manage a list of structures of this construct:

typedef struct {
double quality;
char name[MAX_ESSID_LENGTH];
} wifi_quality;

I expect this to be possible as lists may not always be lists of strings.

In the case it is possible to use GSList to manage lists of custom
structures like the above, which function the type of strdup is used
to allocate memory and prepare a structure so that it would be added
to the list?

I also need to swap two items in the list in a sorting function.

Edward

On 11/09/2015, Rainer Weikusat  wrote:
> "tilt!"  writes:
>> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
>>> Hi all,
>>>
>>> Since yesterday I have been trying to understand why "char**
>>> essid_list" is working inside getInstalledEssidList(&count,
>>> essid_list) but failing as soon as I try to access essid_list[0]
>>> outside the function.
>>>
>>> Both the source and the gdb text output are attached.
>>>
>>> Any helpful pointers are appreciated.
>>
>> Having dynamically growing (and shrinking) lists in C is
>> always a problem. That's why the problem has been solved
>> many times. :-)
>>
>> For example, the singly-linked list, GSList, from the GLIB
>> library is pretty popular and could save you some time.
>
> JFTR: That part of the code is works.
> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Rainer Weikusat
"tilt!"  writes:
> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
>> Hi all,
>>
>> Since yesterday I have been trying to understand why "char**
>> essid_list" is working inside getInstalledEssidList(&count,
>> essid_list) but failing as soon as I try to access essid_list[0]
>> outside the function.
>>
>> Both the source and the gdb text output are attached.
>>
>> Any helpful pointers are appreciated.
>
> Having dynamically growing (and shrinking) lists in C is
> always a problem. That's why the problem has been solved
> many times. :-)
>
> For example, the singly-linked list, GSList, from the GLIB
> library is pretty popular and could save you some time.

JFTR: That part of the code is works.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Rainer Weikusat
Edward Bartolo  writes:
> Since yesterday I have been trying to understand why "char**
> essid_list" is working inside getInstalledEssidList(&count,
> essid_list) but failing as soon as I try to access essid_list[0]
> outside the function.
>
> Both the source and the gdb text output are attached.
>
> Any helpful pointers are appreciated.

The prototype of getInstalledEssidList is

int getInstalledEssidList(int* count, char** essid_list)

and you call that as

char** essid_list;

[...]

getInstalledEssidList(&count, essid_list);

C passes everything by value, hence, getInstalledEssidList gets called
with a copy of the value of the essid_list of the caller (an
uninitialized pointer) and then goes on to modify this copy, ie, changes
don't affect anything outside of the function. In theory, you could pass
a *** and then modify the original pointer but it's a good idea to avoid
avoidable levels of indirection. The easiest way to do something like
this is to return the char ** from the function, returning NULL to
signal failure/ "didn't find anyhting".

NB: getRadiatingWifiList obviously suffers from the same problem and
will need to be modified in the same way.

--
--- automated_scanner.c 2015-09-11 14:42:34.319852358 +0100
+++ a.c 2015-09-11 14:50:28.937357676 +0100
@@ -41,11 +41,14 @@
 } wifi_quality;
 
 
-int getInstalledEssidList(int* count, char** essid_list)
+char **getInstalledEssidList(int* count)
 {
+   char **essid_list;
DIR * dir;
struct dirent * ent;
int el_size = 0; // stands for essid_list size
+
+   essid_list = NULL;
 
// First get a list of installed wireless "interfaces" files
if ((dir = opendir(IFACES_PATH)) != 0) {
@@ -81,10 +84,10 @@
IFACES_PATH, strerror(errno)
);
 
-   return old_errno;
+   return NULL;
}
 
-   return 0;
+   return essid_list;
 }
 
 int getRadiatingWifiList(int* active_wifis, void** active_wifi_list)
@@ -199,7 +202,7 @@
char* scan_buffer;
 
// get a list of currently installed wifi essids
-   getInstalledEssidList(&count, essid_list);
+   essid_list = getInstalledEssidList(&count);
//fprintf(stdout, essid_list[0], "\n"); 
 
// get a list of irradiating wifis
-
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread tilt!

On 09/11/2015 10:35 AM, Edward Bartolo wrote:

Hi all,

Since yesterday I have been trying to understand why "char**
essid_list" is working inside getInstalledEssidList(&count,
essid_list) but failing as soon as I try to access essid_list[0]
outside the function.

Both the source and the gdb text output are attached.

Any helpful pointers are appreciated.


Having dynamically growing (and shrinking) lists in C is
always a problem. That's why the problem has been solved
many times. :-)

For example, the singly-linked list, GSList, from the GLIB
library is pretty popular and could save you some time.

I have attached an example program to demonstrate how GSList
can be used to manage a list of allocated C-type strings.

Best regards,
T.

/* An example program for GSList.
 *
 * Compile with:
 *
 *gcc $(pkg-config --libs glib-2.0 --cflags glib-2.0 ) -o example example.c
 *
 * */

#include 
#include 
#include 

#include 

char * teststring[] = { "hello", "world", NULL };

int main(int argc, char** argv) {
GSList * list = NULL;

// Fill the example list:
char ** a_string = teststring;

while(*a_string) {
list = g_slist_append(list, strdup(*a_string));
a_string++;
}

// Iterate the filled list:
int i = 0, l = g_slist_length(list);

for(i=0; i___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng