Re: [Gambas-user] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread PICCORO McKAY Lenz
2017-07-01 10:59 GMT-04:30 Christof Thalhofer :

> From what database do you query "select * from table" with ODBC?
>
sybase and Oracle, a propietary odbc module does all the job very good, but
i need to use open source,, and freetds have in combination with gambas
lack of a good cursor.. the cursor are foward only, and some things like
record counts from select does not are..  in the oracle way its more
complicated

>
> If you query such a lot of tuples into Sqlite you won't make it better,
> I think. Also a collection seems to be not very fast.
>
tested, very slower... you have right.. sqlite memory more faster but still
slow process passed to sqlite from remote db


>
> Why not use a mature DB like Postgresql? You could try
>
so madure, so good, but not so enterprise, mayor vendors and software
bussines works only with SAP sybase and BI oracle

so if the couple of software to implement does not connect to these
database, then not exits.


> https://wiki.postgresql.org/wiki/Foreign_data_wrappers
>
> If the rows are in Postgres, you can do anything you want.
>
>
> Alles Gute
>
> Christof Thalhofer
>
> --
> Dies ist keine Signatur
>
>
>
> 
> --
> 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] I need a hint on how to deleted duplicate items in a array

2017-07-01 Thread nando_f
there are much faster ways...just a little more 
intricate.

Nando

--
Open WebMail Project (http://openwebmail.org)


-- Original Message ---
From: Fernando Cabral 
To: mailing list for gambas users 
Sent: Sat, 1 Jul 2017 00:18:42 -0300
Subject: Re: [Gambas-user] I need a hint on how to 
deleted duplicate items in a array

> I thank you guys for the hints on counting and 
eliminating duplicates. In
> the end, I resorted to something that is very 
simple and does the trick in
> three steps. In the first step I sort the array.
> In the second step I count the number of 
occurrences and prepend it to the
> word itself (with a separator). In the third step 
I sort the array again,
> so now I have it sorted by the number of 
occurrences from the largest to
> the smallest.
> 
> That is all I need.
> 
> Nevertheless, I am concerned with the performance. 
For 69,725 words, from
> which 8,987 were unique, it took 28 seconds for 
the code below to execute.
> I will survive this 28 seconds, if I have to. But 
I still would like to
> find a faster solution.
> 
> On the other hand, I think I am close to the 
fastest possible solution.
> Basically, the array will be traversed once only, 
no matter how many terms
> and how many repetitions it may have.
> 
> (What do you think about this efficiency, Tobi?)
> 
> *MatchedWords.Sort(gb.ascent + gb.language + 
gb.IgnoreCase) For i = 0 To
> MatchedWords.Maxn = 1For j = i + 1 To 
MatchedWords.Max  If
> (Comp(MatchedWords[i], MatchedWords[j], 
gb.language + gb.ignorecase) = 0)
> Then n += 1  Else Break  
EndifNext
> UniqWords.Push(Format(n, "0###") & "#" & 
MatchedWords[i])i += (n - 1)
> NextUniqWords.Sort(gb.descent + gb.language + 
gb.ignorecase)For i = 0 To
> UniqWords.Max   Print UniqWords[i]Next*
> 
> 2017-06-30 15:10 GMT-03:00 Gianluigi 
:
> 
> > Just for curiosity, on my computer, my function 
(double) processes 10
> > million strings (first and last name) in about 3 
seconds.
> > Very naif measurement using Timers and a limited 
number of names and
> > surnames eg Willy Weber has come up 11051 times
> >
> > To demonstrate the goodness of Tobias' 
arguments, about 1 million 3 cents a
> > second I really understood (I hope) what he 
wanted to say.
> >
> > Sorry my response times but today my modem works 
worse than my brain.
> >
> > Regards
> > Gianluigi
> >
> > 2017-06-30 17:58 GMT+02:00 Gianluigi 
:
> >
> > > Sorry Tobias,
> > > other explanations are not necessary.
> > > I would not be able to understand :-(
> > > I accept what you already explained to me as a 
dogma and I will try to
> > put
> > > it into practice by copying your code :-).
> > >
> > > Thanks again.
> > >
> > > Gianluigi
> > >
> > > 2017-06-30 17:44 GMT+02:00 Gianluigi 
:
> > >
> > >>
> > >> 2017-06-30 17:21 GMT+02:00 Tobias Boege 
:
> > >>
> > >>>
> > >>> I wouldn't say there is anything *wrong* 
with it, but it also has
> > >>> quadratic
> > >>> worst-case running time. You use 
String[].Push() which is just another
> > >>> name
> > >>> for String[].Add(). Adding an element to an 
array (the straightforward
> > >>> way)
> > >>> is done by extending the space of that array 
by one further element and
> > >>> storing the value there. But extending the 
space of an array could
> > >>> potentially
> > >>> require you to copy the whole array 
somewhere else (where you have
> > enough
> > >>> free memory at the end of the array to 
enlarge it). Doing worst-case
> > >>> analysis,
> > >>> we have to assume that this bad case always 
occurs.
> > >>>
> > >>> If you fill an array with n values, e.g.
> > >>>
> > >>>   Dim a As New Integer[]
> > >>>   For i = 1 To n
> > >>> a.Add(i)
> > >>>   Next
> > >>>
> > >>> then you loop n times and in the i-th 
iteration there will be already
> > >>> i-many elements in your array. Adding one 
further element to it will,
> > >>> in the worst case, require i copy operations 
to be performed.
> > 9-year-old
> > >>> C.F. Gauss will tell you that the amount of 
store operations is about
> > >>> n^2.
> > >>>
> > >>>
> > >> Tobias you are always kind and thank you very 
much.
> > >> Is possible for you to explain this more 
elementarily, for me (a poorly
> > >> educated boy :-) )
> > >>
> > >>
> > >>
> > >>> And your function does two jobs 
simultaneously but only returns the
> > >>> result
> > >>> of one of the jobs. The output you get is 
only worth half the time you
> > >>> spent.
> > >>>
> > >>>
> > >> I did two functions in one, just to save 
space, this is a simple
> > example.
> > >> :-)
> > >>
> > >> Regards
> > >> Gianluigi
> > >>
> > >
> > >
> > 

> > --
> > Check out the vibrant tech community on one of 
the world's most
> > engaging tech sites, Slashdot.org! 
http://sdm.link/slashdot
> > 

[Gambas-user] Fwd: Problem to be examined by those who must use UTF8 with Gambas

2017-07-01 Thread Fernando Cabral
-- Forwarded message --
From: Fernando Cabral 
Date: 2017-07-01 17:34 GMT-03:00
Subject: Re: [Gambas-user] Problem to be examined by those who must use
UTF8 with Gambas
To: Jussi Lahtinen 


2017-07-01 16:15 GMT-03:00 Jussi Lahtinen :

> I don't quite get your description of the problem. It seems self
> contradictory. I mean this part:
>
> Perhaps It should sound contradictory. That's because if I write directly
to a TextArea.text from
inside the program, it will show "À" correctly. Nevertheless, if I read the
same string from a file read into a variable and then try to display it...
it does not work.

> Are you using ascii functions for UTF-8 at some point?

I only use ascii functions where there are no UTF-8 functions. For
instance, split().

> I think we need to see your code to understand the issue.

I have attached a text file (ODT) as well as the code itself. Note that, in
order to run the code you will have to have unoconv installed.

If you comment the two lines bellow, the code will not work.



* RawText = RegExp.Replace(RawText, "À", "à") RawText =
RegExp.Replace(RawText, "Ó", "ó")*

This happens because for some mysterious reason, the QT library seems to
get confused
with *À* and *Ó*. But not always!

Jussi



On Sat, Jul 1, 2017 at 8:01 PM, Fernando Cabral <
fernandojosecab...@gmail.com> wrote:

> I've been testing my new toy with every large and small text I can put my
> hands on. The fact is, I have had surprise after surprise. I've just found
> that when I read a text that contains "À" (that's an A with a grave accent
> (`A) -- or  a backward acute accent for those who are not familiar with
> diacritics).
>
> Well, I can't display it if I load it into a TextArea.text. Nothing shows.
> I mean, NOTHING. That is, I have a blank screen. If I bring it to lowercase
> (à or `a) it will show up (in lowercase) with the rest of the text.
>
> So, "`A" (coded as  "\xC3\x80") will prevent the displaying of any string.
> Nevertheless, if I just try to display "Some text plus  À and some text
> more" it will work.
>
> Now, if I take the original text and do:
>
> *  RawText = RegExp.Replace(RawText, "À", "à")*
>
> yep! it does work.
> But if I translate it back with
>
> *  RawText = RegExp.Replace(RawText, "à", "À")*
>
> It does not work anymore.
>
> But if I do
>
> *RawText = RawText & "À"*
>
> And RawText did not contain "À"  before, then it will be displayed.
>
> Amazing.
>
> Any ideas about why this happens?
>
> Regards
>
> - fernando
>
>
>
> --
> 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
>




-- 
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 <(37)%2099988-8868>
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868 <(37)%2099988-8868>
Skype:  fernandojosecabral
Telefone fixo: +55 (37) 3521-2183 <(37)%203521-2183>
Telefone celular: +55 (37) 99988-8868 <(37)%2099988-8868>

Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.




-- 
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.


Test.odt
Description: application/vnd.oasis.opendocument.text


TamPalavras-0.0.1033.tar.gz
Description: GNU Zip compressed data
--
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

[Gambas-user] Fwd: Problem to be examined by those who must use UTF8 with Gambas

2017-07-01 Thread Jussi Lahtinen
-- Forwarded message --
From: Benoît Minisini 
Date: Sun, Jul 2, 2017 at 1:14 AM
Subject: Re: [Gambas-user] Problem to be examined by those who must use
UTF8 with Gambas
To: Jussi Lahtinen , ferna...@fcabral.com.br


Please send that to the mailing-list.

Regards,

Le 02/07/2017 à 00:10, Jussi Lahtinen a écrit :

> OK, this seems to be bug in GTK+ component!
> Go to; Project --> Properties --> Components, and change gb.gui to
> gb.gui.qt, then everything will work as expected. Or you need to wait for
> fix.
>
>
> Jussi
>
>
>
> On Sat, Jul 1, 2017 at 11:34 PM, Fernando Cabral <
> fernandojosecab...@gmail.com > wrote:
>
> 2017-07-01 16:15 GMT-03:00 Jussi Lahtinen  >:
>
> I don't quite get your description of the problem. It seems self
> contradictory. I mean this part:
> /
> /
>
> Perhaps It should sound contradictory. That's because if I write
> directly to a TextArea.text from
> inside the program, it will show "À" correctly. Nevertheless, if I
> read the same string from a file read into a variable and then try
> to display it... it does not work.
>
> > Are you using ascii functions for UTF-8 at some point?
>
> I only use ascii functions where there are no UTF-8 functions. For
> instance, split().
>
> > I think we need to see your code to understand the issue.
>
> I have attached a text file (ODT) as well as the code itself. Note
> that, in order to run the code you will have to have unoconv installed.
>
> If you comment the two lines bellow, the code will not work.
>
> * RawText = RegExp.Replace(RawText, "À", "à")
>   RawText = RegExp.Replace(RawText, "Ó", "ó")
> *
>
> This happens because for some mysterious reason, the QT library
> seems to get confused
> with *À* and *Ó*. But not always!*
> *
>
> Jussi
>
>
>
> On Sat, Jul 1, 2017 at 8:01 PM, Fernando Cabral
> >
>
> wrote:
>
> I've been testing my new toy with every large and small text I
> can put my
> hands on. The fact is, I have had surprise after surprise. I've
> just found
> that when I read a text that contains "À" (that's an A with a
> grave accent
> (`A) -- or  a backward acute accent for those who are not
> familiar with
> diacritics).
>
> Well, I can't display it if I load it into a TextArea.text.
> Nothing shows.
> I mean, NOTHING. That is, I have a blank screen. If I bring it
> to lowercase
> (à or `a) it will show up (in lowercase) with the rest of the text.
>
> So, "`A" (coded as  "\xC3\x80") will prevent the displaying of
> any string.
> Nevertheless, if I just try to display "Some text plus  À and
> some text
> more" it will work.
>
> Now, if I take the original text and do:
>
> *  RawText = RegExp.Replace(RawText, "À", "à")*
>
> yep! it does work.
> But if I translate it back with
>
> *  RawText = RegExp.Replace(RawText, "à", "À")*
>
> It does not work anymore.
>
> But if I do
>
> *RawText = RawText & "À"*
>
> And RawText did not contain "À"  before, then it will be displayed.
>
> Amazing.
>
> Any ideas about why this happens?
>
> Regards
>
> - fernando
>
>
>
> --
> 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  183>
> 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] Problem to be examined by those who must use UTF8 with Gambas

2017-07-01 Thread Jussi Lahtinen
I don't quite get your description of the problem. It seems self
contradictory. I mean this part:




*'So, "`A" (coded as  "\xC3\x80") will prevent the displaying of any
string. Nevertheless, if I just try to display "Some text plus  À and some
text more" it will work.'*
So, what exactly does not work then?
Are you using ascii functions for UTF-8 at some point? I think we need to
see your code to understand the issue.



Jussi



On Sat, Jul 1, 2017 at 8:01 PM, Fernando Cabral <
fernandojosecab...@gmail.com> wrote:

> I've been testing my new toy with every large and small text I can put my
> hands on. The fact is, I have had surprise after surprise. I've just found
> that when I read a text that contains "À" (that's an A with a grave accent
> (`A) -- or  a backward acute accent for those who are not familiar with
> diacritics).
>
> Well, I can't display it if I load it into a TextArea.text. Nothing shows.
> I mean, NOTHING. That is, I have a blank screen. If I bring it to lowercase
> (à or `a) it will show up (in lowercase) with the rest of the text.
>
> So, "`A" (coded as  "\xC3\x80") will prevent the displaying of any string.
> Nevertheless, if I just try to display "Some text plus  À and some text
> more" it will work.
>
> Now, if I take the original text and do:
>
> *  RawText = RegExp.Replace(RawText, "À", "à")*
>
> yep! it does work.
> But if I translate it back with
>
> *  RawText = RegExp.Replace(RawText, "à", "À")*
>
> It does not work anymore.
>
> But if I do
>
> *RawText = RawText & "À"*
>
> And RawText did not contain "À"  before, then it will be displayed.
>
> Amazing.
>
> Any ideas about why this happens?
>
> Regards
>
> - fernando
>
>
>
> --
> 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 determine if array its empty

2017-07-01 Thread Cristiano Guadagnino
Thank you Jussi, that's a nice trick I didn't know of!
Actually, I didn't even notice there was an extra "if" in Gianluigi's
example.

Cris

On Sat, Jul 1, 2017 at 3:28 PM, Jussi Lahtinen 
wrote:

> If you add the extra "if", then Gambas will do short-circuit evaluation.
> https://en.wikipedia.org/wiki/Short-circuit_evaluation
>
>
> Jussi
>
>
>
> On Sat, Jul 1, 2017 at 3:08 PM, Cristiano Guadagnino 
> wrote:
>
> > Hi Gianluigi!
> >
> > On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi  wrote:
> >
> > > or
> > > If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty"
> > >
> >
> > I have not tried, but I don't think this will work. In an "or" expression
> > you have to evaluate both members, so if myArray is null the
> "myArray.Count
> > = 0" part will generate an out of bounds error.
> >
> > Cris
> > 
> > --
> > 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


[Gambas-user] Problem to be examined by those who must use UTF8 with Gambas

2017-07-01 Thread Fernando Cabral
I've been testing my new toy with every large and small text I can put my
hands on. The fact is, I have had surprise after surprise. I've just found
that when I read a text that contains "À" (that's an A with a grave accent
(`A) -- or  a backward acute accent for those who are not familiar with
diacritics).

Well, I can't display it if I load it into a TextArea.text. Nothing shows.
I mean, NOTHING. That is, I have a blank screen. If I bring it to lowercase
(à or `a) it will show up (in lowercase) with the rest of the text.

So, "`A" (coded as  "\xC3\x80") will prevent the displaying of any string.
Nevertheless, if I just try to display "Some text plus  À and some text
more" it will work.

Now, if I take the original text and do:

*  RawText = RegExp.Replace(RawText, "À", "à")*

yep! it does work.
But if I translate it back with

*  RawText = RegExp.Replace(RawText, "à", "À")*

It does not work anymore.

But if I do

*RawText = RawText & "À"*

And RawText did not contain "À"  before, then it will be displayed.

Amazing.

Any ideas about why this happens?

Regards

- fernando



-- 
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] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread Christof Thalhofer
Am 01.07.2017 um 12:35 schrieb PICCORO McKAY Lenz:
> hi cristof, the query its just "select * from table" but where
> "table" its a "cube" of the datawarehouse.. so i want to made a
> something similar to BussinesObject.. so get 200.000 rows its not a
> surprise in desktop..

For a datawarehouse 200.000 rows are not very much. But in a
datawarehouse normally those jobs are running at night. Next day you
look at the results and you get them fast, because these are just a
handful of tuples(records) or there is nothing to be extracted.

> the other problem to force me to get so many rows its the lack of 
> features/connectivity to large scalar DBMS such like DB2, ASE sybase
> or Oracle.. so i must et all the rows firts to later operate in the
> client side, this in any case its better due avoit goin to db on each
> "change" of filters...

From what database do you query "select * from table" with ODBC?

If you query such a lot of tuples into Sqlite you won't make it better,
I think. Also a collection seems to be not very fast.

Why not use a mature DB like Postgresql? You could try
https://wiki.postgresql.org/wiki/Foreign_data_wrappers

If the rows are in Postgres, you can do anything you want.


Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur




signature.asc
Description: OpenPGP digital signature
--
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 determine if array its empty

2017-07-01 Thread Gianluigi
Ok, very precise,
depends on what you need.
I think at work, if you have to read the array, an:

If IsNull (myArray) Or If myArray.Count = 0 Then Return

It is more practice

Gianluigi

2017-07-01 16:15 GMT+02:00 Hans Lehmann :

>
> Case 1:
>   Dim myArray As String[] --> Array not exist.
>
> Case 2:
>   Dim myArray As New String[] --> Array ist empty.
>
> Case 3:
>   Dim myArray As New String[] --> Array is not empty!
>   myArray.Add("Value")
>
>   If Not IsNull(myArray) Then
>  If myArray.Count = 0 Then
> Print "Array ist empty."
>  Else
> Print "Array is not empty!"
>  Endif
>   Else
>  Print "Array not exist."
>   Endif
>
> Hans
>
> 
> --
> 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 determine if array its empty

2017-07-01 Thread Hans Lehmann


Case 1:
  Dim myArray As String[] --> Array not exist.

Case 2:
  Dim myArray As New String[] --> Array ist empty.

Case 3:
  Dim myArray As New String[] --> Array is not empty!
  myArray.Add("Value")

  If Not IsNull(myArray) Then
 If myArray.Count = 0 Then
Print "Array ist empty."
 Else
Print "Array is not empty!"
 Endif
  Else
 Print "Array not exist."
  Endif

Hans

--
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 determine if array its empty

2017-07-01 Thread Gianluigi
Hi Hans,
If the array is not instantiated or does not work (first example) or does
error.

Regards
Gianluigi

2017-07-01 15:36 GMT+02:00 Hans Lehmann :

> Correct?
>
> If (Not IsNull(myArray) And myArray.Count = 0) Then Print "Array is empty"
>
> Hans
>
> 
> --
> 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 determine if array its empty

2017-07-01 Thread Hans Lehmann

Correct?

If (Not IsNull(myArray) And myArray.Count = 0) Then Print "Array is empty"

Hans

--
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] Eliminating duplicates real fast... but adding text do textarea works in a snail pace

2017-07-01 Thread Jussi Lahtinen
Gambas have built in profiler. You might want to get familiar with it.


Jussi

On Sat, Jul 1, 2017 at 3:26 PM, Fernando Cabral <
fernandojosecab...@gmail.com> wrote:

> I want to share with you what seems to be my final solution for the problem
> concerning breaking a text into words, counting them all and eliminating
> duplicates. I was in for a surprise. Maybe you are too.
>
> First, to eliminate duplicates and count occurrences. Here is the code.
> Very simple, very time efficient: only 40 MILLISECONDS to sort 68,626
> words, find and copy 8,984 unique words, prepending a count number and then
> sorting again:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> * MatchedWords.Sort(gb.ascent + gb.language + gb.IgnoreCase) For i = 0 To
> MatchedWords.Maxn = 1For j = i + 1 To MatchedWords.Max  If
> (Comp(MatchedWords[i], MatchedWords[j], gb.language + gb.ignorecase) = 0)
> Then n += 1  Else Break  EndifNext
> UniqWords.Push(Format(n, "0###") & "#" & MatchedWords[i])i += (n - 1)
> Next UniqWords.Sort(gb.descent + gb.language + gb.ignorecase)*
> So, sorting, comparing, copying and sorting again was not the issue.
> Preparing to display was. So much so that the following function took me
> 30+ seconds to add those 8984 words to the TextArea to be displayed:
>
>
>
> *Public Sub AppendText(Text As String)   TextArea1.text &= TextEnd*
>
> But, I was able to reduce that to 32 MILLISECONDS merely by concatenating
> the words into a single string before calling AppendText() just once:
>
>
>
>
>
>
> *str = "" For i = 0 To UniqWords.Max   str &= UniqWords[i] &
> "\n" Next FMain.AppendText(str)*
> So, concatenating here is two orders of magnitude faster than concatenating
> a TextArea. Even thou both were just string concatenation.
>
> In the end, what was taking 30+ do execute came down to 135 MILLISECONDS!
> That's a 222 times reduction.
>
> The lesson I have re-learned one more time: measure, don't guess. What
> seems the culprit might not be. And a innocent-looking function might be
> the killer.
>
> Thank you guys for your help. I've learned a lot about Gambas as well as
> about algorithms.
>
> Regards
>
> - fernando
>
> --
> 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 determine if array its empty

2017-07-01 Thread Jussi Lahtinen
If you add the extra "if", then Gambas will do short-circuit evaluation.
https://en.wikipedia.org/wiki/Short-circuit_evaluation


Jussi



On Sat, Jul 1, 2017 at 3:08 PM, Cristiano Guadagnino 
wrote:

> Hi Gianluigi!
>
> On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi  wrote:
>
> > or
> > If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty"
> >
>
> I have not tried, but I don't think this will work. In an "or" expression
> you have to evaluate both members, so if myArray is null the "myArray.Count
> = 0" part will generate an out of bounds error.
>
> Cris
> 
> --
> 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] SELECT CASE can evaluate multiple "CASE"? at same time

2017-07-01 Thread Jussi Lahtinen
"Case 1, 2"  will do the job.


Jussi

On Sat, Jul 1, 2017 at 2:12 PM, PICCORO McKAY Lenz 
wrote:

> SELECT CASE can evaluate multiple "CASE"? i mean
>
> *Select* *Case* w *Case* *1 or 2*
> print "evaluatin multiple cases at same time" *Case* *Else* *Print* "This
> is impossible!" *End* *Select*
>
> 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
>
--
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 determine if array its empty

2017-07-01 Thread Hans Lehmann

Hallo,

my idea:

Dim myArray As New String[]

' Existiert das Array und ist die Anzahl der Elemente gleich Null, dann 
ist das Array leer

If Not IsNull(myArray) And If myArray.Count = 0 Then Print "Array is empty"

Hans

--
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 determine if array its empty

2017-07-01 Thread PICCORO McKAY Lenz
2017-07-01 8:08 GMT-04:00 Cristiano Guadagnino :

> Hi Gianluigi!
>
> On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi  wrote:
>
> > or
> > If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty"
> >
>
> I have not tried, but I don't think this will work. In an "or" expression
> you have to evaluate both members, so if myArray is null the "myArray.Count
> = 0" part will generate an out of bounds error.
>
ahhh! that's the trick!  thanks!


>
> Cris
> 
> --
> 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 determine if array its empty

2017-07-01 Thread Gianluigi
Hi Cristiano,

Or If is only evaluated if *not* IsNull.

Regards
Gianluigi

2017-07-01 14:08 GMT+02:00 Cristiano Guadagnino :

> Hi Gianluigi!
>
> On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi  wrote:
>
> > or
> > If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty"
> >
>
> I have not tried, but I don't think this will work. In an "or" expression
> you have to evaluate both members, so if myArray is null the "myArray.Count
> = 0" part will generate an out of bounds error.
>
> Cris
> 
> --
> 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] Eliminating duplicates real fast... but adding text do textarea works in a snail pace

2017-07-01 Thread Fernando Cabral
I want to share with you what seems to be my final solution for the problem
concerning breaking a text into words, counting them all and eliminating
duplicates. I was in for a surprise. Maybe you are too.

First, to eliminate duplicates and count occurrences. Here is the code.
Very simple, very time efficient: only 40 MILLISECONDS to sort 68,626
words, find and copy 8,984 unique words, prepending a count number and then
sorting again:















* MatchedWords.Sort(gb.ascent + gb.language + gb.IgnoreCase) For i = 0 To
MatchedWords.Maxn = 1For j = i + 1 To MatchedWords.Max  If
(Comp(MatchedWords[i], MatchedWords[j], gb.language + gb.ignorecase) = 0)
Then n += 1  Else Break  EndifNext
UniqWords.Push(Format(n, "0###") & "#" & MatchedWords[i])i += (n - 1)
Next UniqWords.Sort(gb.descent + gb.language + gb.ignorecase)*
So, sorting, comparing, copying and sorting again was not the issue.
Preparing to display was. So much so that the following function took me
30+ seconds to add those 8984 words to the TextArea to be displayed:



*Public Sub AppendText(Text As String)   TextArea1.text &= TextEnd*

But, I was able to reduce that to 32 MILLISECONDS merely by concatenating
the words into a single string before calling AppendText() just once:






*str = "" For i = 0 To UniqWords.Max   str &= UniqWords[i] &
"\n" Next FMain.AppendText(str)*
So, concatenating here is two orders of magnitude faster than concatenating
a TextArea. Even thou both were just string concatenation.

In the end, what was taking 30+ do execute came down to 135 MILLISECONDS!
That's a 222 times reduction.

The lesson I have re-learned one more time: measure, don't guess. What
seems the culprit might not be. And a innocent-looking function might be
the killer.

Thank you guys for your help. I've learned a lot about Gambas as well as
about algorithms.

Regards

- fernando

-- 
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] how to determine if array its empty

2017-07-01 Thread Cristiano Guadagnino
Hi Gianluigi!

On Sat, Jul 1, 2017 at 12:13 PM, Gianluigi  wrote:

> or
> If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty"
>

I have not tried, but I don't think this will work. In an "or" expression
you have to evaluate both members, so if myArray is null the "myArray.Count
= 0" part will generate an out of bounds error.

Cris
--
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] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread PICCORO McKAY Lenz
2017-07-01 6:38 GMT-04:30 Fernando Cabral :

> I think you should be more specific. Instead of saying "the real problem is
> the lack of
> gambas to handle many DB features", let us know which those [lacking]
> features are.
>
yet explainet and bug filet to gambasbugtraker .. you read the mail without
the hole behaviour



>
--
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] SELECT CASE can evaluate multiple "CASE"? at same time

2017-07-01 Thread PICCORO McKAY Lenz
SELECT CASE can evaluate multiple "CASE"? i mean

*Select* *Case* w *Case* *1 or 2*
print "evaluatin multiple cases at same time" *Case* *Else* *Print* "This
is impossible!" *End* *Select*

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] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread Fernando Cabral
2017-07-01 6:30 GMT-03:00 PICCORO McKAY Lenz :

> all of those question are not relevant, the real problem its the lack of
> gambas to handle many DB features due the ODBC connection..
>

I think you should be more specific. Instead of saying "the real problem is
the lack of
gambas to handle many DB features", let us know which those [lacking]
features are.
I am sure if you do so the master professionals in this list will be able
to tell you if
those features are really missing; if there are good workarounds; or
perhaps if you
should forget gambas and try something different.

If gambas can not do what you have to do, then I see no point in insisting.
But, if you want to get some help in clarifying this issue, then you' be
better be
more specific.

Regards

- fernando


>
> >
> > rgrds
> > b
> >
> > --
> > B Bruen 
> >
> > 
> > --
> > 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! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread PICCORO McKAY Lenz
hi cristof, the query its just "select * from table" but where "table" its
a "cube" of the datawarehouse.. so i want to made a something similar to
BussinesObject.. so get 200.000 rows its not a surprise in desktop..

the other problem to force me to get so many rows its the lack of
features/connectivity to large scalar DBMS such like DB2, ASE sybase or
Oracle.. so i must et all the rows firts to later operate in the client
side, this in any case its better due avoit goin to db on each "change" of
filters...

in any case, seems the better approach its usage of in-memory sqlite db..
and for the 30 minutes in my case seems its something on the gambas
installation.. but debug and thenn report a bug its quite complicated for
me right now.. im focused in odbc+handle data for now

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

2017-07-01 5:32 GMT-04:30 Christof Thalhofer :

> Am 30.06.2017 um 00:57 schrieb PICCORO McKAY Lenz:
>
> > i'm taking about 200.000 rows in a result... the problem its that the
> odbc
> > db object support only cursor with forward only..
>
> Show us your query. For what do you need 200.000 rows? That's way too
> much if you want to visialize anything.
>
>
> Alles Gute
>
> Christof Thalhofer
>
> --
> Dies ist keine Signatur
>
>
> 
> --
> 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 determine if array its empty

2017-07-01 Thread Gianluigi
or
If IsNull(myArray) Or If myArray.Count = 0 Then Print "Empty"

Regards
Gianluigi

2017-07-01 12:09 GMT+02:00 Gianluigi :

> Dim myArray As String[]
>
>   If IsNull(myArray) Then Print "Empty"
>
> Regards
> Gianluigi
>
> 2017-07-01 11:33 GMT+02:00 PICCORO McKAY Lenz :
>
>> i have
>>
>>  Dim ar As New Variant[]
>>
>> so how can i determine if the array its empty, i mean does not added any
>> element.. due that piece of code fails:
>>
>> If value.dim > 0 Then
>>
>> If value.count > 0 Then
>>
>> with a index out of bound exception
>>
>> 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
>>
>
>
--
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 determine if array its empty

2017-07-01 Thread Gianluigi
Dim myArray As String[]

  If IsNull(myArray) Then Print "Empty"

Regards
Gianluigi

2017-07-01 11:33 GMT+02:00 PICCORO McKAY Lenz :

> i have
>
>  Dim ar As New Variant[]
>
> so how can i determine if the array its empty, i mean does not added any
> element.. due that piece of code fails:
>
> If value.dim > 0 Then
>
> If value.count > 0 Then
>
> with a index out of bound exception
>
> 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
>
--
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] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread Christof Thalhofer
Am 30.06.2017 um 00:57 schrieb PICCORO McKAY Lenz:

> i'm taking about 200.000 rows in a result... the problem its that the odbc
> db object support only cursor with forward only..

Show us your query. For what do you need 200.000 rows? That's way too
much if you want to visialize anything.


Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur



signature.asc
Description: OpenPGP digital signature
--
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 determine if array its empty

2017-07-01 Thread PICCORO McKAY Lenz
i have

 Dim ar As New Variant[]

so how can i determine if the array its empty, i mean does not added any
element.. due that piece of code fails:

If value.dim > 0 Then

If value.count > 0 Then

with a index out of bound exception

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] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread PICCORO McKAY Lenz
thanks in advance adamnt42, i need to convert the result due missing odbc
important features...

2017-07-01 3:06 GMT-04:30 adamn...@gmail.com :

> Well, 30 minutes does sound very excessive. Are you certain that it's the
> "unmarshalling" that is taking the time and not the execution of the query
> itself? That is why I separated the timings in my figures above.
>
yes, its not the query.. i hit pause and the data its yet in client side..

Regarding using the memory based SQLite database approach, I wouldn't think
> that it would help. I don't know the actual "size" of the data returned by
> your query, but I would expect that you would get a major memory hit and a
> lot of paging by going that way.  I have used the memory SQLite database
> several times for manipulating several hundred or so records and it is
> quite fast but wouldn't even consider it for a dataset that large (and I
> guess it would be just adding another layer of processing to handle your
> query Result).
>
i made the test and in part you have right, get mayor memory hit, the only
benefice i got was now i have a valid cursor due odbc does nto offer me

By the way, where is your source database? Is it on your machine or on a
> networked machine?  I had one of the lads in our office try the same thing
> that I did, but using the master database on our LAN. It took a bit longer,
> 38 seconds to execute the query rather than 31 so as I expected, network
> access to the database plays a fairly large part. ~20% for a query
> returning a set that large.
>
all of those question are not relevant, the real problem its the lack of
gambas to handle many DB features due the ODBC connection.. the cursor are
forward only so i cannot fill a gridview faster or play with it like others
DBMS


> So again, I would looking for other causes of that massive time if I were
> you.
>
the only cause of my problems, its some ODBC missing features (module
driver part) and innability of gambas to connect natively to many DBMS


>
> rgrds
> b
>
> --
> B Bruen 
>
> 
> --
> 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] any way to convert Result to Collection more faster than copy?

2017-07-01 Thread adamn...@gmail.com
On Fri, 30 Jun 2017 08:41:49 -0400
PICCORO McKAY Lenz  wrote:

> i get more than 30 minutes, due i must parse to a low end machine, not to
> your 4 cores, 16Gb ram super power machine.. i'm taking about a 1G ram and
> single core 1,6GHz  atom cpu
> 
> i need to convert from Result/cursor to other due the problem of the odbc
> lack of cursor/count ..
> 
> i thinking about use a sqlite memory structure, how can i force it?
> documentation said "If Name is null, then a memory database is opened." for
> sqlite..
> 
> so if i used a memory structure can be a good idea? *tested yesterday took
> about 10 minutes but i dont know if i have a problem in my gambas
> installation!*
> 
> 
> 
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
> 
> 2017-06-30 4:09 GMT-04:00 adamn...@gmail.com :
(SNIP)
> > Here's the timing output.
> >
> > 17:05:59:706Connecting to DB
> > 17:06:00:202Loading Data< so 406 mSec to establish the db
> > connection
> > 17:06:31:417556502 rows < so 31,215 mSec to execute the query
> > and return the result
> > 17:06:31:417Unmarshalling result started
> > 17:06:44:758Unmarshalling completed 556502 rows processed  <---  so 
> > 13,341 mSec to unmarshall the result into an array of structs
> >
> > So, it took roughly 31 seconds to execute the query and return the result
> > of half a million rows.
> > To unmarshall that result into the array took just over 13 seconds. The
> > unmarshalling is fairly well a straight field by field copy.
> > (Also I must add, I ran this on a local db copy on  my old steam driven
> > laptop, 32 bits and about 1G of memory.)
> >
(CORRECTED)
> > That's about 42 rows per mSec unmarshalling time or about 0.024 mSec per 
> > row.
>>

Well, 30 minutes does sound very excessive. Are you certain that it's the 
"unmarshalling" that is taking the time and not the execution of the query 
itself? That is why I separated the timings in my figures above.
Regarding your machine capability, my laptop is very similar to what you 
described (Single core, 1GB memory). The only real difference I can see is a 
1.7GHtz maximum clock speed.
So I don't think that's the cause of the difference.  If I imagine your query 
on this PC I would expect about 20 * 0.024 mSec to unmarshall it, say about 
5 seconds.

Regarding using the memory based SQLite database approach, I wouldn't think 
that it would help. I don't know the actual "size" of the data returned by your 
query, but I would expect that you would get a major memory hit and a lot of 
paging by going that way.  I have used the memory SQLite database several times 
for manipulating several hundred or so records and it is quite fast but 
wouldn't even consider it for a dataset that large (and I guess it would be 
just adding another layer of processing to handle your query Result).

By the way, where is your source database? Is it on your machine or on a 
networked machine?  I had one of the lads in our office try the same thing that 
I did, but using the master database on our LAN. It took a bit longer, 38 
seconds to execute the query rather than 31 so as I expected, network access to 
the database plays a fairly large part. ~20% for a query returning a set that 
large.  

Query optimisation?  We tend to use the Connection.Exec approach here for large 
queries as it let's us optimise both the database and the SQL for maximum 
benefit rather than rely on the
Gambas driver generated queries. (That's not a criticism by the way, its just 
that when dealing with large datasets our results have been better.)  For 
example, in the query I have been
talking about and using the timing, we create a temporary index on a boolean 
column that is one of the WHERE clause criteria, with the NULLS FIRST option 
set on the index.  Since we
are looking to select all the rows from that table where a flag (the 
"reconciled" column)  has not been set, they are all at the front of that 
index. As soon as the back end query engine hits an index entry for a row that 
has been reconciled it "knows" that it has finished. At the end of the query we 
just delete that index again.  Before I did that the query execution time was 
several minutes and now we are down to about 5 seconds (for the "real" query on 
the "real" database which returns up to 1 rows). 

So again, I would looking for other causes of that massive time if I were you.

rgrds
b

-- 
B Bruen 

--
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