Re: [Gambas-user] how to log to stdout/stderr

2017-07-13 Thread Fernando Cabral
2017-07-13 21:21 GMT-03:00 PICCORO McKAY Lenz :

> the nohup trick not always work.. for that there's the gambas redirection
> print.. that's why i ask previously how i detec if are runnig inside ide..
> if are inside ide. let normal print, if not, redirect...
>
> I am not sure I have understood what you said. What I can say is that, for
logging purpose, you can just open a regular file and then write to or
append to.

In order to determine if your application is running as a daemon or not, if
can be quite easy and fool proof. For intance, you can create a command
line options like, say "-d". If it is present, your applicaiton should run
as a daemon, so you act accordingly. Otherwise the application is not
running as daemon, so you should act as a regular application.

As to printing (if you mean, printing to a printer proper) you can either
open a pipe to the printer daemon or else create a file and then use a
shell () instruction to print and delete that file. Both should work well.

- fernando




> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-07-13 19:54 GMT-04:00 Fernando Cabral :
>
> > 2017-07-13 17:11 GMT-03:00 Tobias Boege  said:
> >
> > > As we discussed recently [1], stdout and stderr are redirected to
> > /dev/null
> > > when you daemonise, so there is not really any value in wanting to
> print
> > > there if you want to make a daemon.
> >
> >
> > I don't know if I have understood you correctly and completely.
> >  I am an old timer and Linux may have changed things as compared to UNIX.
> > A daemon is supposed to run in the background. Typically, when you put
> > something to
> > run in the background, Unix would send the standard output to... standard
> > output.
> >
> > Now, if you do "nohup something.gambas", standard outuput will to to
> > "nohup.out".
> > But, if you do "nohup something.gambas >x &" or "something.gambas >x",
> > standard output wll be sent to "x".
> >
> > In any case, if you don't want to preserve any output, you should
> redirect
> > stderr and
> > stdout to /dev/null.
> >
> > I would guess that a daemon started at startup or by cron would give the
> > same result.
> > Am I wrong?
> >
> > Regards
> >
> > - fernando
> >
> > > [1] https://sourceforge.net/p/gambas/mailman/gambas-user/
> > > thread/1498036647346-59450.post%40n7.nabble.com/#msg35904830
> > > [2] https://stackoverflow.com/questions/17954432/creating-a-
> > > daemon-in-linux
> > >
> > > --
> > > "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> > >
> > > 
> > > --
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > ___
> > > Gambas-user mailing list
> > > Gambas-user@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >
> >
> >
> >
> > --
> > Fernando Cabral
> > Blogue: http://fernandocabral.org
> > Twitter: http://twitter.com/fjcabral
> > e-mail: fernandojosecab...@gmail.com
> > Facebook: f...@fcabral.com.br
> > Telegram: +55 (37) 99988-8868
> > Wickr ID: fernandocabral
> > WhatsApp: +55 (37) 99988-8868
> > Skype:  fernandojosecabral
> > Telefone fixo: +55 (37) 3521-2183
> > Telefone celular: +55 (37) 99988-8868
> >
> > Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> > nenhum político ou cientista poderá se gabar de nada.
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecab...@gmail.com
Facebook: f...@fcabral.com.br
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype:  fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868

Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! 

[Gambas-user] gui controls are only applied to components, cant able use as libraries

2017-07-13 Thread PICCORO McKAY Lenz
i made several components, and when i try to reuse as libraries (i
generated the gambas and link/use in properties tab) can instanciate the
object/class but cannot useit .. gambas said that "some componets are
missing"

for those class not are gui, gambas said "missing class"


Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] how to log to stdout/stderr

2017-07-13 Thread PICCORO McKAY Lenz
in part you have right fernando.. but that was dicuss several time
previously.. i want to no made special commands to daemonize my app.. i
want my app are daemon by selft..

now my app are a property daemon.. and every night at 00:00 restart all
setting and starts a new day to regist people..

the log must also be manage by the application.. if not then its not a
proper daemon..

the nohup trick not always work.. for that there's the gambas redirection
print.. that's why i ask previously how i detec if are runnig inside ide..
if are inside ide. let normal print, if not, redirect...

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-07-13 19:54 GMT-04:00 Fernando Cabral :

> 2017-07-13 17:11 GMT-03:00 Tobias Boege  said:
>
> > As we discussed recently [1], stdout and stderr are redirected to
> /dev/null
> > when you daemonise, so there is not really any value in wanting to print
> > there if you want to make a daemon.
>
>
> I don't know if I have understood you correctly and completely.
>  I am an old timer and Linux may have changed things as compared to UNIX.
> A daemon is supposed to run in the background. Typically, when you put
> something to
> run in the background, Unix would send the standard output to... standard
> output.
>
> Now, if you do "nohup something.gambas", standard outuput will to to
> "nohup.out".
> But, if you do "nohup something.gambas >x &" or "something.gambas >x",
> standard output wll be sent to "x".
>
> In any case, if you don't want to preserve any output, you should redirect
> stderr and
> stdout to /dev/null.
>
> I would guess that a daemon started at startup or by cron would give the
> same result.
> Am I wrong?
>
> Regards
>
> - fernando
>
> > [1] https://sourceforge.net/p/gambas/mailman/gambas-user/
> > thread/1498036647346-59450.post%40n7.nabble.com/#msg35904830
> > [2] https://stackoverflow.com/questions/17954432/creating-a-
> > daemon-in-linux
> >
> > --
> > "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> >
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
>
> --
> Fernando Cabral
> Blogue: http://fernandocabral.org
> Twitter: http://twitter.com/fjcabral
> e-mail: fernandojosecab...@gmail.com
> Facebook: f...@fcabral.com.br
> Telegram: +55 (37) 99988-8868
> Wickr ID: fernandocabral
> WhatsApp: +55 (37) 99988-8868
> Skype:  fernandojosecabral
> Telefone fixo: +55 (37) 3521-2183
> Telefone celular: +55 (37) 99988-8868
>
> Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> nenhum político ou cientista poderá se gabar de nada.
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] how to log to stdout/stderr

2017-07-13 Thread Fernando Cabral
2017-07-13 17:11 GMT-03:00 Tobias Boege  said:

> As we discussed recently [1], stdout and stderr are redirected to /dev/null
> when you daemonise, so there is not really any value in wanting to print
> there if you want to make a daemon.


I don't know if I have understood you correctly and completely.
 I am an old timer and Linux may have changed things as compared to UNIX.
A daemon is supposed to run in the background. Typically, when you put
something to
run in the background, Unix would send the standard output to... standard
output.

Now, if you do "nohup something.gambas", standard outuput will to to
"nohup.out".
But, if you do "nohup something.gambas >x &" or "something.gambas >x",
standard output wll be sent to "x".

In any case, if you don't want to preserve any output, you should redirect
stderr and
stdout to /dev/null.

I would guess that a daemon started at startup or by cron would give the
same result.
Am I wrong?

Regards

- fernando

> [1] https://sourceforge.net/p/gambas/mailman/gambas-user/
> thread/1498036647346-59450.post%40n7.nabble.com/#msg35904830
> [2] https://stackoverflow.com/questions/17954432/creating-a-
> daemon-in-linux
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecab...@gmail.com
Facebook: f...@fcabral.com.br
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype:  fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868

Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread Gianluigi
Great Tobias,

You are a good teacher and I am honored to have your attention.
OK I understand, never more extravagant mathematics.
Thank you very much for your explanations

Regards
Gianluigi

P.S. You will not believe it but some tests with Floor and Ceil I did :-(

2017-07-13 20:00 GMT+02:00 Tobias Boege :

> On Thu, 13 Jul 2017, Gianluigi wrote:
> > I would not be misunderstood.
> > I had understood that Alex wanted a forced increase "Round".
> >
> > To recap:
> >
> >   Dim n As Float = 26.66016
> >   Dim b As Byte
> >
> >   Print Int(n * 100) / 100  ' Normal truncate, as already
> > mentioned by other
> >   Print Round(n, -2)' Normal round, as already
> > mentioned by other
> >   If Len(CStr(Frac(n))) > 4 Then
> > b = Val(Mid(CStr(Frac(n)), 5, 1))
> > If b >= 5 Then
> >   Print Round(n, -2)
> > Else
> >   Print Round(n + 0.01, -2) ' Forced increase round, as
> > proposed by me
> > Endif
> >   Endif
> >
>
> I would avoid arithmetic operations involving even more floats, such as you
> proposed. Consider this:
>
>   $ gbx3 -e 'Round(0.8099950+0.1,-9)'
>   0.90999
>   $ gbx3 -e 'Round(0.8099951+0.1,-9)'
>   0.91
>
> I only changed the very last digit (of order 10^-11) from 0 to 1 which
> shouldn't influence the rouding to 9 decimals at all -- but it does!
>
> The problem here is, famously, that the decimal 0.1 has no finite binary
> representation, so *storing* the value that is represented in decimal by
> the string "0.1" in a binary float already gives you an unavoidable error.
> Whenever you use 0.1 in your program, this error propagates. Specifically,
> the error when storing 0.1 in a Single is about 1.49*10^-9, which is how
> I arrived at that example above.
>
> Of course, the same applies to the 0.01 you use above. You can think
> by yourself about a similar example where float addition with 0.01 makes
> the result of a later rounding unreliable.
>
> The other method
>
>   Floor(n*100)/100  ' round down to two decimals
>   Ceil(n*100)/100   ' round up to two decimals
>
> is reliable, since the *integer* 100 can be stored without error in a
> float and IEEE754 requires the outcome of float arithmetic to be the
> same as if the operation was performed exactly and then rounded to the
> limited precision of the float datatype [1].
>
> Regards,
> Tobi
>
> [1] http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html#865
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] how to log to stdout/stderr

2017-07-13 Thread PICCORO McKAY Lenz
ok, thanks.. that's the mail ([1])

the problem of make right answer its the languaje barrier.. in my countrie
its very spensive make a english course, and internet connection are very
slowly and spensive too

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-07-13 16:11 GMT-04:00 Tobias Boege :

> On Thu, 13 Jul 2017, PICCORO McKAY Lenz wrote:
> > hello toby, when i set the gambas binary to backgroud to runs as daemon
> > ...and lauch other gambas process from that gambas ...
> >
> > then the stdout and stderr does not have that behaviour you said!
> > so then?
> >
>
> You're wrong, it does exactly what you wanted and specifically asked about:
> print to stdout and stderr.
>
> As we discussed recently [1], stdout and stderr are redirected to /dev/null
> when you daemonise, so there is not really any value in wanting to print
> there if you want to make a daemon.
>
> If you still want the output of your system daemon to arrive somewhere, you
> have to point stdout and stderr to somewhere meaningful again, like your
> syslog. You can also make your own log files as was discussed in [1], if
> you
> don't have a real *system* daemon that should be integrated into the
> systemd
> (or what have you) ecosystem. There is information available about this on
> the net [2], which is completely independent of Gambas, BTW.
>
> There's an(other) old saying: If you want a good answer you have to ask a
> very good question.
>
> Regards,
> Tobi
>
> [1] https://sourceforge.net/p/gambas/mailman/gambas-user/
> thread/1498036647346-59450.post%40n7.nabble.com/#msg35904830
> [2] https://stackoverflow.com/questions/17954432/creating-a-
> daemon-in-linux
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] About gambas, the word

2017-07-13 Thread PICCORO McKAY Lenz
all of this conversation give so much hungry:

a coup of WINE, with some friet GAMBAS!

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-07-13 16:28 GMT-04:00 Fabien Bodard :

> 2017-07-13 20:44 GMT+02:00 Jussi Lahtinen :
> > Many open source projects have animal name or logo. So I guess it's just
> > old tradition.
>
> In fact the tradition for geek programmers in the unix world was to
> find a recurssive acronym.
>
> It means the Name is an acronym that contain the name itself
>
> WINE  = Wine Is Not Emulator
>
> GAMBAS = Gambas Almost Mean BASic
>
> So the logo of something looking a bit to a shrimp was a logical
> choice... Well normally shrimps have not claws... but i find it give
> an idea of super powerfull shrimp ;-)
>
> >
> > Jussi
> >
> > On Thu, Jul 13, 2017 at 11:18 AM, Jorge Carrión 
> wrote:
> >
> >> It's a joke, I think. Searching for something that contains BAS, from
> >> Basic. Why an animal I don't know. Benoit likes to eat prawns, I
> >> soppouse...
> >>
> >> 
> >>
> >> Best Regards
> >>
> >> 2017-07-13 8:37 GMT+02:00 Fernando Cabral  >:
> >>
> >> > *Warning: this is only a linguistic curiosity with no relation to
> Gambas,
> >> > the language.*
> >> >
> >> > Entirely by chance, I came across the following definition and
> etymology
> >> > for gambas, the word:
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > *From Petit Robert 2007: gambasgambas [gɑ̃bas] nom féminin
> plurielétym.
> >> > répandu v. 1960; catalan gamba, du latin populaire cambarus, classique
> >> > cammarus, du grec kammarosv■ Grosses crevettes comestibles de la
> >> > Méditerranée. Gambas frites (è scampi), grillées. Brochette de
> gambas.▫
> >> > Rare Une gamba [gɑ̃ba].*
> >> > In Brazil, I never heard the word gamba. I never found it in written
> >> text.
> >> > Nevertheless, at least one Brazilian dictionary registers it as a
> Spanish
> >> > word only recently introduced into Portuguese. So, perhaps it is used
> in
> >> > Portugal.
> >> >
> >> > Anyway, it is interesting to know that, in the end, it comes from
> Greek
> >> > "kammaros" that gave us the Portuguese "camarão" and the Italian
> >> > "gamberetto". Nevertheless, at the first sight, it is hard to see that
> >> > "gamba" and "camarão" come from the same Greek word.
> >> >
> >> > --
> >> > Fernando Cabral
> >> > Blogue: http://fernandocabral.org
> >> > Twitter: http://twitter.com/fjcabral
> >> > e-mail: fernandojosecab...@gmail.com
> >> > Facebook: f...@fcabral.com.br
> >> > Telegram: +55 (37) 99988-8868
> >> > Wickr ID: fernandocabral
> >> > WhatsApp: +55 (37) 99988-8868
> >> > Skype:  fernandojosecabral
> >> > Telefone fixo: +55 (37) 3521-2183
> >> > Telefone celular: +55 (37) 99988-8868
> >> >
> >> > Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> >> > nenhum político ou cientista poderá se gabar de nada.
> >> > 
> >> > --
> >> > Check out the vibrant tech community on one of the world's most
> >> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> >> > ___
> >> > Gambas-user mailing list
> >> > Gambas-user@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >> >
> >> 
> >> --
> >> Check out the vibrant tech community on one of the world's most
> >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> >> ___
> >> Gambas-user mailing list
> >> Gambas-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> > 
> --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] About gambas, the word

2017-07-13 Thread Fabien Bodard
2017-07-13 20:44 GMT+02:00 Jussi Lahtinen :
> Many open source projects have animal name or logo. So I guess it's just
> old tradition.

In fact the tradition for geek programmers in the unix world was to
find a recurssive acronym.

It means the Name is an acronym that contain the name itself

WINE  = Wine Is Not Emulator

GAMBAS = Gambas Almost Mean BASic

So the logo of something looking a bit to a shrimp was a logical
choice... Well normally shrimps have not claws... but i find it give
an idea of super powerfull shrimp ;-)

>
> Jussi
>
> On Thu, Jul 13, 2017 at 11:18 AM, Jorge Carrión  wrote:
>
>> It's a joke, I think. Searching for something that contains BAS, from
>> Basic. Why an animal I don't know. Benoit likes to eat prawns, I
>> soppouse...
>>
>> 
>>
>> Best Regards
>>
>> 2017-07-13 8:37 GMT+02:00 Fernando Cabral :
>>
>> > *Warning: this is only a linguistic curiosity with no relation to Gambas,
>> > the language.*
>> >
>> > Entirely by chance, I came across the following definition and etymology
>> > for gambas, the word:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > *From Petit Robert 2007: gambasgambas [gɑ̃bas] nom féminin plurielétym.
>> > répandu v. 1960; catalan gamba, du latin populaire cambarus, classique
>> > cammarus, du grec kammarosv■ Grosses crevettes comestibles de la
>> > Méditerranée. Gambas frites (è scampi), grillées. Brochette de gambas.▫
>> > Rare Une gamba [gɑ̃ba].*
>> > In Brazil, I never heard the word gamba. I never found it in written
>> text.
>> > Nevertheless, at least one Brazilian dictionary registers it as a Spanish
>> > word only recently introduced into Portuguese. So, perhaps it is used in
>> > Portugal.
>> >
>> > Anyway, it is interesting to know that, in the end, it comes from Greek
>> > "kammaros" that gave us the Portuguese "camarão" and the Italian
>> > "gamberetto". Nevertheless, at the first sight, it is hard to see that
>> > "gamba" and "camarão" come from the same Greek word.
>> >
>> > --
>> > Fernando Cabral
>> > Blogue: http://fernandocabral.org
>> > Twitter: http://twitter.com/fjcabral
>> > e-mail: fernandojosecab...@gmail.com
>> > Facebook: f...@fcabral.com.br
>> > Telegram: +55 (37) 99988-8868
>> > Wickr ID: fernandocabral
>> > WhatsApp: +55 (37) 99988-8868
>> > Skype:  fernandojosecabral
>> > Telefone fixo: +55 (37) 3521-2183
>> > Telefone celular: +55 (37) 99988-8868
>> >
>> > Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
>> > nenhum político ou cientista poderá se gabar de nada.
>> > 
>> > --
>> > Check out the vibrant tech community on one of the world's most
>> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> > ___
>> > Gambas-user mailing list
>> > Gambas-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] ho to use code snipes

2017-07-13 Thread Tobias Boege
On Thu, 13 Jul 2017, PICCORO McKAY Lenz wrote:
> i see for constructor "_new" the "_n" but how to use it?
> 

http://gambaswiki.org/wiki/ide/idesnippets :

  Entering a code shortcut at the beginning of a line and pressing the TAB
  key will automatically expand the shortcut into a defined piece of code.

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] ho to use code snipes

2017-07-13 Thread PICCORO McKAY Lenz
i see for constructor "_new" the "_n" but how to use it?

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] how to log to stdout/stderr

2017-07-13 Thread Tobias Boege
On Thu, 13 Jul 2017, PICCORO McKAY Lenz wrote:
> hello toby, when i set the gambas binary to backgroud to runs as daemon
> ...and lauch other gambas process from that gambas ...
> 
> then the stdout and stderr does not have that behaviour you said!
> so then?
> 

You're wrong, it does exactly what you wanted and specifically asked about:
print to stdout and stderr.

As we discussed recently [1], stdout and stderr are redirected to /dev/null
when you daemonise, so there is not really any value in wanting to print
there if you want to make a daemon.

If you still want the output of your system daemon to arrive somewhere, you
have to point stdout and stderr to somewhere meaningful again, like your
syslog. You can also make your own log files as was discussed in [1], if you
don't have a real *system* daemon that should be integrated into the systemd
(or what have you) ecosystem. There is information available about this on
the net [2], which is completely independent of Gambas, BTW.

There's an(other) old saying: If you want a good answer you have to ask a
very good question.

Regards,
Tobi

[1] 
https://sourceforge.net/p/gambas/mailman/gambas-user/thread/1498036647346-59450.post%40n7.nabble.com/#msg35904830
[2] https://stackoverflow.com/questions/17954432/creating-a-daemon-in-linux

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] how to log to stdout/stderr

2017-07-13 Thread PICCORO McKAY Lenz
hello toby, when i set the gambas binary to backgroud to runs as daemon
...and lauch other gambas process from that gambas ...

then the stdout and stderr does not have that behaviour you said!
so then?

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-07-13 14:11 GMT-04:00 Tobias Boege :

> On Thu, 13 Jul 2017, PICCORO McKAY Lenz wrote:
> > how can i log to stdout and stderr my program actions/methods/things ?
> >
> > note that due vendor/client i cannot use gambas 3.5+ only 3.4... due its
> > the already installed..
> >
> > some time ago benoit respond me that recent version of gambas implements
> > something similar already,
> > but i cannot find the main in the horrible sourgeforce heavyweith web
> > interface
> >
>
> The PRINT instruction writes to stdout (by default) and the ERROR
> instruction to stderr (by default). There is also DEBUG which writes
> to stderr and includes the filename, function name and line number
> where it is executed at the beginning of the output. It is for print-
> style debugging and if you don't compile the project with gbc3's
> "-g" switch the DEBUG statements will NOT be compiled, so don't do
> anything in those statements which could have side effects.
>
> You can change the default stream PRINT and ERROR/DEBUG operate on
> by OUTPUT TO and ERROR TO.
>
> Those things must have been in Gambas since forever, there is by far
> no 3.x version requirement. The more sophisticated (by always broken
> when I tried it, IIRC) component gb.logging was added in Gambas 3.5,
> but if you just want to print to stdout and stderr, there is no reason
> to use it.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] About gambas, the word

2017-07-13 Thread Jussi Lahtinen
Many open source projects have animal name or logo. So I guess it's just
old tradition.


Jussi

On Thu, Jul 13, 2017 at 11:18 AM, Jorge Carrión  wrote:

> It's a joke, I think. Searching for something that contains BAS, from
> Basic. Why an animal I don't know. Benoit likes to eat prawns, I
> soppouse...
>
> 
>
> Best Regards
>
> 2017-07-13 8:37 GMT+02:00 Fernando Cabral :
>
> > *Warning: this is only a linguistic curiosity with no relation to Gambas,
> > the language.*
> >
> > Entirely by chance, I came across the following definition and etymology
> > for gambas, the word:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > *From Petit Robert 2007: gambasgambas [gɑ̃bas] nom féminin plurielétym.
> > répandu v. 1960; catalan gamba, du latin populaire cambarus, classique
> > cammarus, du grec kammarosv■ Grosses crevettes comestibles de la
> > Méditerranée. Gambas frites (è scampi), grillées. Brochette de gambas.▫
> > Rare Une gamba [gɑ̃ba].*
> > In Brazil, I never heard the word gamba. I never found it in written
> text.
> > Nevertheless, at least one Brazilian dictionary registers it as a Spanish
> > word only recently introduced into Portuguese. So, perhaps it is used in
> > Portugal.
> >
> > Anyway, it is interesting to know that, in the end, it comes from Greek
> > "kammaros" that gave us the Portuguese "camarão" and the Italian
> > "gamberetto". Nevertheless, at the first sight, it is hard to see that
> > "gamba" and "camarão" come from the same Greek word.
> >
> > --
> > Fernando Cabral
> > Blogue: http://fernandocabral.org
> > Twitter: http://twitter.com/fjcabral
> > e-mail: fernandojosecab...@gmail.com
> > Facebook: f...@fcabral.com.br
> > Telegram: +55 (37) 99988-8868
> > Wickr ID: fernandocabral
> > WhatsApp: +55 (37) 99988-8868
> > Skype:  fernandojosecabral
> > Telefone fixo: +55 (37) 3521-2183
> > Telefone celular: +55 (37) 99988-8868
> >
> > Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> > nenhum político ou cientista poderá se gabar de nada.
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] how to log to stdout/stderr

2017-07-13 Thread Tobias Boege
On Thu, 13 Jul 2017, PICCORO McKAY Lenz wrote:
> how can i log to stdout and stderr my program actions/methods/things ?
> 
> note that due vendor/client i cannot use gambas 3.5+ only 3.4... due its
> the already installed..
> 
> some time ago benoit respond me that recent version of gambas implements
> something similar already,
> but i cannot find the main in the horrible sourgeforce heavyweith web
> interface
> 

The PRINT instruction writes to stdout (by default) and the ERROR
instruction to stderr (by default). There is also DEBUG which writes
to stderr and includes the filename, function name and line number
where it is executed at the beginning of the output. It is for print-
style debugging and if you don't compile the project with gbc3's
"-g" switch the DEBUG statements will NOT be compiled, so don't do
anything in those statements which could have side effects.

You can change the default stream PRINT and ERROR/DEBUG operate on
by OUTPUT TO and ERROR TO.

Those things must have been in Gambas since forever, there is by far
no 3.x version requirement. The more sophisticated (by always broken
when I tried it, IIRC) component gb.logging was added in Gambas 3.5,
but if you just want to print to stdout and stderr, there is no reason
to use it.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread Tobias Boege
On Thu, 13 Jul 2017, Gianluigi wrote:
> I would not be misunderstood.
> I had understood that Alex wanted a forced increase "Round".
> 
> To recap:
> 
>   Dim n As Float = 26.66016
>   Dim b As Byte
> 
>   Print Int(n * 100) / 100  ' Normal truncate, as already
> mentioned by other
>   Print Round(n, -2)' Normal round, as already
> mentioned by other
>   If Len(CStr(Frac(n))) > 4 Then
> b = Val(Mid(CStr(Frac(n)), 5, 1))
> If b >= 5 Then
>   Print Round(n, -2)
> Else
>   Print Round(n + 0.01, -2) ' Forced increase round, as
> proposed by me
> Endif
>   Endif
> 

I would avoid arithmetic operations involving even more floats, such as you
proposed. Consider this:

  $ gbx3 -e 'Round(0.8099950+0.1,-9)'
  0.90999
  $ gbx3 -e 'Round(0.8099951+0.1,-9)'
  0.91

I only changed the very last digit (of order 10^-11) from 0 to 1 which
shouldn't influence the rouding to 9 decimals at all -- but it does!

The problem here is, famously, that the decimal 0.1 has no finite binary
representation, so *storing* the value that is represented in decimal by
the string "0.1" in a binary float already gives you an unavoidable error.
Whenever you use 0.1 in your program, this error propagates. Specifically,
the error when storing 0.1 in a Single is about 1.49*10^-9, which is how
I arrived at that example above.

Of course, the same applies to the 0.01 you use above. You can think
by yourself about a similar example where float addition with 0.01 makes
the result of a later rounding unreliable.

The other method

  Floor(n*100)/100  ' round down to two decimals
  Ceil(n*100)/100   ' round up to two decimals

is reliable, since the *integer* 100 can be stored without error in a
float and IEEE754 requires the outcome of float arithmetic to be the
same as if the operation was performed exactly and then rounded to the
limited precision of the float datatype [1].

Regards,
Tobi

[1] http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html#865

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] how to log to stdout/stderr

2017-07-13 Thread PICCORO McKAY Lenz
how can i log to stdout and stderr my program actions/methods/things ?

note that due vendor/client i cannot use gambas 3.5+ only 3.4... due its
the already installed..

some time ago benoit respond me that recent version of gambas implements
something similar already,
but i cannot find the main in the horrible sourgeforce heavyweith web
interface


Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread Gianluigi
I would not be misunderstood.
I had understood that Alex wanted a forced increase "Round".

To recap:

  Dim n As Float = 26.66016
  Dim b As Byte

  Print Int(n * 100) / 100  ' Normal truncate, as already
mentioned by other
  Print Round(n, -2)' Normal round, as already
mentioned by other
  If Len(CStr(Frac(n))) > 4 Then
b = Val(Mid(CStr(Frac(n)), 5, 1))
If b >= 5 Then
  Print Round(n, -2)
Else
  Print Round(n + 0.01, -2) ' Forced increase round, as
proposed by me
Endif
  Endif

Regards

Gianluigi

2017-07-13 17:31 GMT+02:00 PICCORO McKAY Lenz :

> 2017-07-13 1:46 GMT-04:00 bb :
>
> > I always round i.e. Print Round(26.66016,-2) -->
>
> the digits see -> .660
>
>
> > which is 26.66 by the way, not 26.67! (I have no idea how you got that.)
>
>
> due 660 and -2 said the firts two digits, the round will take effect only
> in last digit.. due the last no have another mayor than 5, then let in "6"
>
> sorry i dont know how to explain, i deal with this several months ago and
> solve it in that way
>
>
>
> >
> >
> > b
> >
> >
> >
> >
> > On 13/07/17 15:09, alexchernoff wrote:
> >
> >> Peace to all,
> >>
> >> this might a bit silly but what is the best way to format float values
> >> like
> >> 26.66016 into having two digits AND/OR  with rounding them?
> >>
> >> e.g.
> >>
> >> 26.66016 becomes 26.66 shortened
> >> 26.66016 becomes 26.67 rounded
> >>
> >> cheers!
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context: http://gambas.8142.n7.nabble.c
> >> om/Best-ways-to-format-float-values-tp59733.html
> >> Sent from the gambas-user mailing list archive at Nabble.com.
> >>
> >> 
> >> --
> >> Check out the vibrant tech community on one of the world's most
> >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> >> ___
> >> Gambas-user mailing list
> >> Gambas-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> >>
> >
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Gambas in a tablet. Is it possible?

2017-07-13 Thread PICCORO McKAY Lenz
2017-07-13 1:41 GMT-04:00 alexchernoff :

> There is a software called NSBasic that can build Android apps and is very
>
it's another mess up, a guindows-only stupid software...

the idea its complete develop in linux to deploy in the others/all
platforms, i'm tyred of guindows
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] About gambas, the word

2017-07-13 Thread PICCORO McKAY Lenz
2017-07-13 4:18 GMT-04:00 Jorge Carrión :

> Benoit likes to eat prawns, I soppouse...
>

ka ka ka ka

>.<  

as a post note: GAMBAS acron of that its not basic


>
> 
>
> Best Regards
>
> 2017-07-13 8:37 GMT+02:00 Fernando Cabral :
>
> > *Warning: this is only a linguistic curiosity with no relation to Gambas,
> > the language.*
> >
> > Entirely by chance, I came across the following definition and etymology
> > for gambas, the word:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > *From Petit Robert 2007: gambasgambas [gɑ̃bas] nom féminin plurielétym.
> > répandu v. 1960; catalan gamba, du latin populaire cambarus, classique
> > cammarus, du grec kammarosv■ Grosses crevettes comestibles de la
> > Méditerranée. Gambas frites (è scampi), grillées. Brochette de gambas.▫
> > Rare Une gamba [gɑ̃ba].*
> > In Brazil, I never heard the word gamba. I never found it in written
> text.
> > Nevertheless, at least one Brazilian dictionary registers it as a Spanish
> > word only recently introduced into Portuguese. So, perhaps it is used in
> > Portugal.
> >
> > Anyway, it is interesting to know that, in the end, it comes from Greek
> > "kammaros" that gave us the Portuguese "camarão" and the Italian
> > "gamberetto". Nevertheless, at the first sight, it is hard to see that
> > "gamba" and "camarão" come from the same Greek word.
> >
> > --
> > Fernando Cabral
> > Blogue: http://fernandocabral.org
> > Twitter: http://twitter.com/fjcabral
> > e-mail: fernandojosecab...@gmail.com
> > Facebook: f...@fcabral.com.br
> > Telegram: +55 (37) 99988-8868
> > Wickr ID: fernandocabral
> > WhatsApp: +55 (37) 99988-8868
> > Skype:  fernandojosecabral
> > Telefone fixo: +55 (37) 3521-2183
> > Telefone celular: +55 (37) 99988-8868
> >
> > Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> > nenhum político ou cientista poderá se gabar de nada.
> > 
> > --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread PICCORO McKAY Lenz
2017-07-13 1:46 GMT-04:00 bb :

> I always round i.e. Print Round(26.66016,-2) -->

the digits see -> .660


> which is 26.66 by the way, not 26.67! (I have no idea how you got that.)


due 660 and -2 said the firts two digits, the round will take effect only
in last digit.. due the last no have another mayor than 5, then let in "6"

sorry i dont know how to explain, i deal with this several months ago and
solve it in that way



>
>
> b
>
>
>
>
> On 13/07/17 15:09, alexchernoff wrote:
>
>> Peace to all,
>>
>> this might a bit silly but what is the best way to format float values
>> like
>> 26.66016 into having two digits AND/OR  with rounding them?
>>
>> e.g.
>>
>> 26.66016 becomes 26.66 shortened
>> 26.66016 becomes 26.67 rounded
>>
>> cheers!
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://gambas.8142.n7.nabble.c
>> om/Best-ways-to-format-float-values-tp59733.html
>> Sent from the gambas-user mailing list archive at Nabble.com.
>>
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread Charlie
Also consider: -

Public Sub Main() 
Dim fNum As Float[] = [26.66016, 26.66516] 'Note 26.660..
and 26.665..
Dim fTemp As Float

For Each fTemp In fNum
  fTemp *= 100
  fTemp += 0.5
  fTemp = Int(fTemp)
  fTemp /= 100
  Print fTemp;;
Next

'Output 26.66 26.67

End




-
Check out www.gambas.one 
--
View this message in context: 
http://gambas.8142.n7.nabble.com/Best-ways-to-format-float-values-tp59733p59743.html
Sent from the gambas-user mailing list archive at Nabble.com.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread Gianluigi
One thing that could be useful?

Public Sub Main()

  Dim n As Float = 26.66016
  Dim b As Byte

  b = Val(Mid(CStr(Frac(n)), 5, 1))
  Print Round(n, -2)
  If b >= 5 Then
Print Round(n, -2)
  Else
Print Round(n + 0.01, -2)
  Endif

End

Regards
Gianluigi

2017-07-13 7:39 GMT+02:00 alexchernoff :

> Peace to all,
>
> this might a bit silly but what is the best way to format float values like
> 26.66016 into having two digits AND/OR  with rounding them?
>
> e.g.
>
> 26.66016 becomes 26.66 shortened
> 26.66016 becomes 26.67 rounded
>
> cheers!
>
>
>
>
>
> --
> View this message in context: http://gambas.8142.n7.nabble.
> com/Best-ways-to-format-float-values-tp59733.html
> Sent from the gambas-user mailing list archive at Nabble.com.
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] How to use drag-and-drop

2017-07-13 Thread Rolf-Werner Eilert



Am 11.07.2017 um 12:23 schrieb Charlie:

Rolf-Werner Eilert-2 wrote

The basic usage of the drag-and-drop functions isn't quite clear to me.
I couldn't find much information in the wiki about it. Here is my code.
I use t$ as a simple storage place and TextBox1 is only to see what the
thing does.

The user should pick the red cell in GridView1 and drag it to another
cell. The contents should appear there.

I use "MouseUp" and not "Drop" because Drop didn't have any result. But
maybe the way I implemented the whole thing isn't the right one anyhow?

Your code works. Is it that you want to drag the Background colour as well?
You can only drag Text or Images so if you want the Background as well you
will need to use other tricks. Try your modified code below. If I have
missed the point let me know.

Public Sub GridView1_MouseUp()

TextBox1.Text = GridView1.Row & "::" & GridView1.Column
GridView1.Current.Text = t$
GridView1.Current.Background = iBackGround

End




Thank you Charlie for your answer.

I wonder why GridView1_Drop doesn't fire here. So I was forced to use 
MouseUp instead. The inconvenience here is that I have to use a flag to 
distinguish whether it was a Drag-and-Drop action that fired MouseUp, or 
a usual Mouse action that ended there. Otherwise you may get errors when 
you click or pull handles or whatever.


So, when GridView1.Drop is True, and I implemented everything correctly, 
why is GridView1_Drop not fired?


Regards
Rolf


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread Charlie
alexchernoff wrote
> Peace to all,
> 
> this might a bit silly but what is the best way to format float values
> like 26.66016 into having two digits AND/OR  with rounding them?
> 
> e.g.
> 26.66016 becomes 26.66 shortened
> 26.66016 becomes 26.67 rounded
> 
> cheers!

You said 'Format' so you could use: -

Print Format("26.66016", "#.00") '26.66
Print Format("26", "#.00") '26.00
Print Format("1.533", "#.00") '1.53




-
Check out www.gambas.one 
--
View this message in context: 
http://gambas.8142.n7.nabble.com/Best-ways-to-format-float-values-tp59733p59740.html
Sent from the gambas-user mailing list archive at Nabble.com.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] About gambas, the word

2017-07-13 Thread Charlie Reinl
Am Donnerstag, den 13.07.2017, 10:18 +0200 schrieb Jorge Carrión:
> It's a joke, I think. Searching for something that contains BAS, from
> Basic. Why an animal I don't know. Benoit likes to eat prawns, I soppouse...
> 
> 
> 
> Best Regards
> 
> 2017-07-13 8:37 GMT+02:00 Fernando Cabral :
> 
> > *Warning: this is only a linguistic curiosity with no relation to Gambas,
> > the language.*
> >
> > Entirely by chance, I came across the following definition and etymology
> > for gambas, the word:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > *From Petit Robert 2007: gambasgambas [gɑ̃bas] nom féminin plurielétym.
> > répandu v. 1960; catalan gamba, du latin populaire cambarus, classique
> > cammarus, du grec kammarosv■ Grosses crevettes comestibles de la
> > Méditerranée. Gambas frites (è scampi), grillées. Brochette de gambas.▫
> > Rare Une gamba [gɑ̃ba].*
> > In Brazil, I never heard the word gamba. I never found it in written text.
> > Nevertheless, at least one Brazilian dictionary registers it as a Spanish
> > word only recently introduced into Portuguese. So, perhaps it is used in
> > Portugal.
> >
> > Anyway, it is interesting to know that, in the end, it comes from Greek
> > "kammaros" that gave us the Portuguese "camarão" and the Italian
> > "gamberetto". Nevertheless, at the first sight, it is hard to see that
> > "gamba" and "camarão" come from the same Greek word.
> >

There is the old meaning : Gambas Almost Means BASIC!

look here http://gambas.sourceforge.net/en/main.html 
-- 
Amicalement
Charlie


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] About gambas, the word

2017-07-13 Thread Jorge Carrión
It's a joke, I think. Searching for something that contains BAS, from
Basic. Why an animal I don't know. Benoit likes to eat prawns, I soppouse...



Best Regards

2017-07-13 8:37 GMT+02:00 Fernando Cabral :

> *Warning: this is only a linguistic curiosity with no relation to Gambas,
> the language.*
>
> Entirely by chance, I came across the following definition and etymology
> for gambas, the word:
>
>
>
>
>
>
>
>
>
>
> *From Petit Robert 2007: gambasgambas [gɑ̃bas] nom féminin plurielétym.
> répandu v. 1960; catalan gamba, du latin populaire cambarus, classique
> cammarus, du grec kammarosv■ Grosses crevettes comestibles de la
> Méditerranée. Gambas frites (è scampi), grillées. Brochette de gambas.▫
> Rare Une gamba [gɑ̃ba].*
> In Brazil, I never heard the word gamba. I never found it in written text.
> Nevertheless, at least one Brazilian dictionary registers it as a Spanish
> word only recently introduced into Portuguese. So, perhaps it is used in
> Portugal.
>
> Anyway, it is interesting to know that, in the end, it comes from Greek
> "kammaros" that gave us the Portuguese "camarão" and the Italian
> "gamberetto". Nevertheless, at the first sight, it is hard to see that
> "gamba" and "camarão" come from the same Greek word.
>
> --
> Fernando Cabral
> Blogue: http://fernandocabral.org
> Twitter: http://twitter.com/fjcabral
> e-mail: fernandojosecab...@gmail.com
> Facebook: f...@fcabral.com.br
> Telegram: +55 (37) 99988-8868
> Wickr ID: fernandocabral
> WhatsApp: +55 (37) 99988-8868
> Skype:  fernandojosecabral
> Telefone fixo: +55 (37) 3521-2183
> Telefone celular: +55 (37) 99988-8868
>
> Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> nenhum político ou cientista poderá se gabar de nada.
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] About gambas, the word

2017-07-13 Thread Fernando Cabral
*Warning: this is only a linguistic curiosity with no relation to Gambas,
the language.*

Entirely by chance, I came across the following definition and etymology
for gambas, the word:










*From Petit Robert 2007: gambasgambas [gɑ̃bas] nom féminin plurielétym.
répandu v. 1960; catalan gamba, du latin populaire cambarus, classique
cammarus, du grec kammarosv■ Grosses crevettes comestibles de la
Méditerranée. Gambas frites (è scampi), grillées. Brochette de gambas.▫
Rare Une gamba [gɑ̃ba].*
In Brazil, I never heard the word gamba. I never found it in written text.
Nevertheless, at least one Brazilian dictionary registers it as a Spanish
word only recently introduced into Portuguese. So, perhaps it is used in
Portugal.

Anyway, it is interesting to know that, in the end, it comes from Greek
"kammaros" that gave us the Portuguese "camarão" and the Italian
"gamberetto". Nevertheless, at the first sight, it is hard to see that
"gamba" and "camarão" come from the same Greek word.

-- 
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecab...@gmail.com
Facebook: f...@fcabral.com.br
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype:  fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868

Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Best ways to format float values

2017-07-13 Thread Fernando Cabral
I can say this is the best way to do what you want, but I use the following:





* Print Int(100.55 * 100) / 100.00 Print Round(100.55, -2)*
The first operation truncates the number to 100.55 (no rounding takes
effect).
The second operation rounds the number to at most two digits after the
decimal separator.
This means in the example above, result will be 100.56. If the number was
100.5
it would be rounded to 100.6.

Again, I dont know if those are the best way to do it, but it works.

Regards

-fernando



2017-07-13 2:39 GMT-03:00 alexchernoff :

> Peace to all,
>
> this might a bit silly but what is the best way to format float values like
> 26.66016 into having two digits AND/OR  with rounding them?
>
> e.g.
>
> 26.66016 becomes 26.66 shortened
> 26.66016 becomes 26.67 rounded
>
> cheers!
>
>
>
>
>
> --
> View this message in context: http://gambas.8142.n7.nabble.
> com/Best-ways-to-format-float-values-tp59733.html
> Sent from the gambas-user mailing list archive at Nabble.com.
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecab...@gmail.com
Facebook: f...@fcabral.com.br
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype:  fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868

Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user