Re: [fpc-pascal] Re: TimSort

2011-05-25 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said: > > A quick look at wikipedia will show that timsort has a disadvantage too. It > > needs up to N records memory, not just Log(n) records like e.g. Quicksort. > It *can* be implemented to need only log(n). But the current fpc > implementation > of

RE : Re[2]: [fpc-pascal] fpWeb and html and uri escaping/unescapingelements

2011-05-25 Thread Ludo Brands
You should not unescape recursively. Input to EscapeHTML: '<' Output: '<' : Correct UnescapeHTML: input '<' Output '<' Wrong. This is because you replace '&' with '&' resulting in '<' which is translated to '< ' in the next line. Ludo -Message d'origine- De : fpc-pascal-bou

Re: RE : Re[2]: [fpc-pascal] fpWeb and html and uri escaping/unescapingelements

2011-05-25 Thread ik
On Wed, May 25, 2011 at 10:09, Ludo Brands wrote: > You should not unescape recursively. > Input to EscapeHTML: '<' Output: '<' : Correct > UnescapeHTML: input '<' Output '<' Wrong. > This is because you replace '&' with '&' resulting in '<' which is > translated to '< ' in the next lin

Re: [fpc-pascal] Re: TimSort

2011-05-25 Thread Mattias Gaertner
On Wed, 25 May 2011 09:02:46 +0200 (CEST) mar...@stack.nl (Marco van de Voort) wrote: > In our previous episode, Mattias Gaertner said: > > > A quick look at wikipedia will show that timsort has a disadvantage too. > > It > > > needs up to N records memory, not just Log(n) records like e.g. >

RE : [fpc-pascal] fpWeb and html and uri escaping/unescaping elements

2011-05-25 Thread Ludo Brands
This is a very minimalistic implementation covering only partial ascii character escaping. To cover ASCII only in unescapeHTML you should also add ' ' which corresponds with the space character ' '. Also the format &#entity_number; is missing ('<' or '<' equals '<') To support iso-8859-1 which is

Re[4]: [fpc-pascal] fpWeb and html and uri escaping/unescaping elements

2011-05-25 Thread José Mejuto
Hello FPC-Pascal, Wednesday, May 25, 2011, 8:33:57 AM, you wrote: >> "<" i> I'm not sure what you mean here. That's an already escaped html. Let it be a mini htmlpage: -<- i> If you have already html entities you should not escape them. If you do not i> have html entities you should esca

Re[2]: [fpc-pascal] Re: TimSort

2011-05-25 Thread José Mejuto
Hello FPC-Pascal, Wednesday, May 25, 2011, 9:02:46 AM, you wrote: MvdV> For heavier sorting I usually use heapsort and quicksort routines that date MvdV> back to my M2 days MvdV> Usually heapsort since it is quite fast for already sorted collections. Instead HeapSort you can use SmoothSort whic

RE : RE : Re[2]: [fpc-pascal] fpWeb and html and uriescaping/unescapingelements

2011-05-25 Thread Ludo Brands
> So you suggest to place the & translation last. That would be a solution for this problem. My previous comments on the "minimalistic" approach of the implementation suggest a different approach: scan the source string once and replace html entities as you find them (with a look up table for exam

Re: RE : RE : Re[2]: [fpc-pascal] fpWeb and html and uriescaping/unescapingelements

2011-05-25 Thread ik
On Wed, May 25, 2011 at 14:04, Ludo Brands wrote: > > So you suggest to place the & translation last. > That would be a solution for this problem. My previous comments on the > "minimalistic" approach of the implementation suggest a different approach: > scan the source string once and replace h

Re: RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
2011/5/24 Ludo Brands : > The following delphi articles should help creating an event sink: > > http://www.informit.com/articles/article.aspx?p=130494&seqNum=5  This is an > interesting one since it is written for Delphi 3-4 which missed a lot of the > automated COM handling. This is much closer to

RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Ludo Brands
Interfaceconnect calls Advice on the objects IConnectionPoint. I can't share Delphi code here but essentially what you do is: Get IConnectionPointContainer (CPC) from IUnknown (ActiveXObject) : ActiveXObject.QueryInterface(IConnectionPointContainer, CPC); Get IConnectionPoint (ppcp) for the IID

RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Ludo Brands
Regarding the tlb to pascal "conversion", AFAIK there is no support in fpc. Delphi is clearly better equiped to work with COM objects. I have also been playing around with a generic eventsink class but the problem is that events can have parameters (and a lot do). Your suggestion of using TNotifyE

Re: RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
2011/5/25 Ludo Brands : > Regarding the tlb to pascal "conversion", AFAIK there is no support in fpc. > Delphi is clearly better equiped to work with COM objects. > > I have also been playing around with a generic eventsink class but the > problem is that events can have parameters (and a lot do).

[fpc-pascal] Re: fpc-pascal Digest, Vol 83, Issue 52

2011-05-25 Thread Luis Fernando Del Aguila Mejía
El 25/05/2011 01:35 a.m., fpc-pascal-requ...@lists.freepascal.org escribió: Question out of curiosity: Is there a reason why you allocate an array "by hand"? Yes, getmem return NIL, when no more memory is available. SetLength, no return NIL, It is work with Exceptions. My intention was whether

RE : RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Ludo Brands
The code in article http://www.informit.com/articles/article.aspx?p=130494&seqNum=5 goes a long way in doing what you want to do. Unit Eventsink does pretty much of the legwork. You should remove the procedure register since that is the Delphi way to get a component on the toolbar. Remove also the

[fpc-pascal] Re: Suffix Trie implementation, please review

2011-05-25 Thread leledumbo
> I guess you forgot the attachment? My bad... well it was midnight here ;) There you go: http://free-pascal-general.1045716.n5.nabble.com/file/n4425751/suffixtrie.zip suffixtrie.zip > BTW, do you know the hashtrie component? Only ever heard of, never know the details. Thanks, this could be a

Re: RE : RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
2011/5/25 Ludo Brands : > The code in article > http://www.informit.com/articles/article.aspx?p=130494&seqNum=5 goes a long > way in doing what you want to do. Unit Eventsink does pretty much of the > legwork. You should remove the procedure register since that is the Delphi > way to get a componen

Re: [fpc-pascal] getmem

2011-05-25 Thread Luis Fernando Del Aguila Mejía
El 25/05/2011 01:35 a.m., fpc-pascal-requ...@lists.freepascal.org escribió: Question out of curiosity: Is there a reason why you allocate an array "by hand"? Yes, getmem return NIL, when no more memory is available. SetLength, no return NIL, It is work with Exceptions. My intention was whether

RE : RE : RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Ludo Brands
Using variants you can transparently "walk" along the exposed objects. The variant contains the Idispatch of the object and gets the exposed methods at runtime. Properties are implemented as get and put methods or just get methods for read only properties. If you have something like Itransducers

Re: RE : RE : RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
Always thanks! Given your evident experience on this matter, I kindly ask your advice on what is best to do. opt 1) create a fpc class with some pascal style methods, which in their implementation use variants and call the IDevice class with late-binding . meaning that there is no compiler ch