Re: [fpc-pascal] FCL-WEB and PostgreSQL Support: Current Status

2017-09-29 Thread Daniel Gaspary
On Fri, Sep 29, 2017 at 5:37 AM, Michael Van Canneyt
 wrote:

> FPC really has all you need, even in 2017 ;)
>

I agree, just needed some details. :)

Thank you for the help.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FCL-WEB and PostgreSQL Support: Current Status

2017-09-28 Thread Daniel Gaspary
On Thu, Sep 28, 2017 at 6:11 PM, Michael Van Canneyt
 wrote:
> 1. You can perfectly start the fastcgi in the debugger if you use proxy
> server
> or if you use mod_fastcgi confgured with fastcgiexternalserver configuration
> setting. I believe nginx only uses the proxy mechanism.

Nice to know about this configuration. It seens similar to what I was
imagining, using unix sockets(optionally)

> 2. If that is not an option, there is also the following:
> FPC contains a cgi to fastcgi request converter, you can use that to debug
> the fastcgi by running it inside the debugger, and let apache forward the
> request using the cgi bridge.

Could you elaborate about this bridge? Is some apache/nginx
configuration, an external tool, using some apache mod.. ??

> 3. Third option:
>FCL-Web is transparant in the sense that the code for CGI/FastCGI/Apache
>module or standalone HTTP server is 100% the same. Only the used
>TCustomApplication descendent differs for these 4 environments.
>
> That means you can debug your code using the HTTP server, and switch to
> using FastCGI in production. I use an {$IFDEF } in the project file to
> switch the hosting environment. For the business code this is transparant.

This and the first appear to be the simpler options.

>> Any chance of extend the component / create a new one, with support to
>> receive and send data ?
>
> No. I don't see the need. See above, there are plenty of mechanisms to debug
> a web environment.

I mean .. Not just for this case, but to have a more capable IPC.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Coroutines and VirtualAlloc

2017-04-19 Thread Daniel Gaspary
So..

Any chance of an Official implementation ?

On Wed, Apr 19, 2017 at 10:50 AM, Marco van de Voort  wrote:
> In our previous episode, Ryan Joseph said:
>> > Your example is simply broken. A few points:
>>
>> Thanks for the description. Yeah, I assumed the stack would be restored but 
>> that isn?t the case apparently.
>>
>> I think the coroutine implementation in the link below tries to manage the 
>> stack frames and restore them but it requires Windows for the VirtualAlloc 
>> function and I?m on a Mac. No idea if that code works or not and it looks 
>> kind of risky honestly.
>>
>> http://www.festra.com/wwwboard/messages/12899.html
>
> Not just virtual alloc, nearly the whole of the asm is accessing SEH via fs
> and thus Windows dependent.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Coroutines and VirtualAlloc

2017-04-18 Thread Daniel Gaspary
On Sat, Apr 15, 2017 at 6:20 AM, Ryan Joseph  wrote:
> I was curious about possible ways coroutines could work in FPC and found this 
> example that claims to implement just that. It appears to be designed for 
> Windows though and makes use of a function called VirtualAlloc which I don’t 
> understand. Is there a non platform specific version of this function? I’d 
> like to test the code but I have no idea what that function does or how to 
> replace it.


Using  SetJmp and LongJmp?

I believe some months ago it was a discussion on the list on why this
was not really the way to implement coroutines.

Searching for longjmp/setjmp you can find the thread, I guess.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] WebAssembly Target

2017-03-17 Thread Daniel Gaspary
On Fri, Mar 17, 2017 at 2:55 PM, Michael Van Canneyt
 wrote:
> Forgot to say that there will of course be some classes to manipulate the
> DOM at will.


Thank you, Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] WebAssembly Target

2017-03-17 Thread Daniel Gaspary
On Fri, Mar 17, 2017 at 5:16 AM, Michael Van Canneyt
 wrote:
> In fact, there is an alternate approach, transpiling pascal to Javascript.
>
> It's much farther ahead than the webassembly target, already produces
> programs running in the browser and the first web-based components are
> already being developed using this approach.

What is the role of those components ?

Reading this thread I was thinking would be nice (easier to work) ) to
have access to browser components via a fpc lib.

Something like fcl-browser-facilities (terrible name, I know), where
you could simple calls to DOM parts.

Whether this is already in fcl-js, sorry, I didn't knew about it..
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] WebAssembly Target

2017-03-11 Thread Daniel Gaspary
Hi,

   Is there something planned in this matter for FPC?

   I was reading about the new Firefox making WebAssembly publicly
available ("On Tuesday Firefox 52 became the first browser to support
WebAssembly
")
[1] .

  Thanks.


[1]
https://developers.slashdot.org/story/17/03/11/1627245/will-webassembly-replace-javascript
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] raw socket example

2015-11-18 Thread Daniel Gaspary
Need to change the fpsocket function call.


>From fpSocket(AF_INET,SOCK_STREAM,0)
to fpSocket(AF_INET,SOCK_RAW,0);

Is possible that the "0" needs to be changed too.



On Wed, Nov 18, 2015 at 3:20 PM, leledumbo  wrote:
> FPC docs has them:
> http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html (server)
> http://www.freepascal.org/docs-html/rtl/sockets/fpconnect.html (client)
>
>
>
>
> --
> View this message in context: 
> http://free-pascal-general.1045716.n5.nabble.com/raw-socket-example-tp5723096p5723097.html
> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] XML Canonicalization Support

2015-10-16 Thread Daniel Gaspary
On Fri, Oct 16, 2015 at 8:11 AM, Michael Van Canneyt
 wrote:
> Not to my knowledge.

The TDomParser has an option to cannonical form:

Parser := TDOMParser.Create;
Parser.Options.CanonicalForm:=True;


TXmlWriter seems to have support too.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Misleading Statement at Comparison Operator Description

2015-08-25 Thread Daniel Gaspary
Hi,

   I believe the statement[1] bellow is not accurate:

   The result type of a comparison operator is always a boolean.

   Because this code compiles and works:


program Project1;
type
TMyType1 = class(TObject);
TMyType2 = class(TObject);
TMyType3 = class(TObject);

operator  (t1: TMyType1; t2: TMyType2): TMyType3;
begin
 //some code...
end;

var
   t3: TMyType3;
begin
 t3:=TMyType1.Create  TMyType2.Create;
end.

Am I Wrong, the documentation need fixing.. ?

Thank you.

[1] http://www.freepascal.org/docs-html/ref/refse93.html#x198-20800015.5
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] NTP

2015-01-29 Thread Daniel Gaspary
Synapse has a unit for the protocol:

http://www.ararat.cz/synapse/doku.php/features


On Thu, Jan 29, 2015 at 6:10 AM, Torsten Bonde Christiansen
t...@epidata.info wrote:
 Hi,

 Does anyone have experience on how to get the current date/time of an NTP
 server?

 Regards,
 Torsten.

 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SDL_Net vs Synapse

2015-01-05 Thread Daniel Gaspary
On Mon, Jan 5, 2015 at 2:44 PM, Sandro Cumerlato
sandro.cumerl...@gmail.com wrote:
 Pascal-SDL-2-Headers can be found on GitHub at:

 https://github.com/ev1313/Pascal-SDL-2-Headers

Good to know. Thank you for sharing, Sandro.

Is it a fork from another older version that was posted here?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SDL_Net vs Synapse

2015-01-05 Thread Daniel Gaspary
On Mon, Jan 5, 2015 at 4:55 PM, Brian v...@golden.net wrote:
 SDL2 Headers also available here ...

 http://sourceforge.net/projects/sdl2fpc/

We'll end the day knowing new two up to date SDL2 binding projects.

Thank you, Brian
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SDL_Net vs Synapse

2015-01-05 Thread Daniel Gaspary
On Mon, Jan 5, 2015 at 1:23 PM, Brian v...@golden.net wrote:
 Any opinions/experience pro/con using SDL2 (SDL_Net) vs Synapse
 (http://synapse.ararat.cz/doku.php) ?

Does SDL2 net FPC binding exist?

The non-existence would be a big con.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TDomNode to text and/or document

2014-09-22 Thread Daniel Gaspary
On Mon, Sep 22, 2014 at 8:21 AM, Felipe Monteiro de Carvalho
felipemonteiro.carva...@gmail.com wrote:
 Ummm, this doesn't seam to help much... but I eventually found googling.

 The error is EDOMWrongDocument, which makes sense since I want to
 insert a TDOMNode from another document ... so I have to first import
 and then attach the node:

   lDoc := TXMLDocument.Create;
   try
 lImportedNode := lDoc.ImportNode(ANode, True);
 lDoc.AppendChild(lImportedNode);

I didn't knew this method, but looking the code I understand why. Is
because it is almost an alias to CloneNode, the method I use.


 By the way, whats the difference between TDOMNode and TDOMElement? 
 Confusing...

TDomNode is the base class, can be an attribute, a Processing
Instruction, a Text node...

TDomElement is one of its descendents.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Fast HTML Parser

2014-08-08 Thread Daniel Gaspary
On Fri, Aug 8, 2014 at 9:40 AM, Marco van de Voort mar...@stack.nl wrote:
 There is xpath support in fcl-xml?

Yes. But HTML files used to be very irregular XML.  Some files can
raise an error when trying to open.

Things like p without closing element were easy to find.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Junior Tasks

2014-06-08 Thread Daniel Gaspary
Hi,

   is this page[1] up to date?

   I believe would be interesting to have a page(a dedicated system,
bugtracker tag?) where people can volunteer to help with small, well
defined tasks.

   Maybe something similar to this[2], but more elaborate and covering
not only conversion.

   I know that anyone can submit patches to the bugtracker, but I'm
talking about a kind of fpc/lazarus subprojects where volunteer work
could be useful.

  If such page/system already exists, please inform the URL.

  Thank you,

   Daniel



[1] (Junior Developer tasks) http://www.freepascal.org/future.html
[2] wiki.lazarus.freepascal.org/Current_conversion_projects
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Database Metadata proposal

2014-06-03 Thread Daniel Gaspary
On Tue, Jun 3, 2014 at 2:46 AM, LacaK la...@zoznam.sk wrote:
 TSQLConnection.GetTableNames(List: TStrings; SchemaName : String; Options :
 TSchemaOptions);

 Which IMO fits better in existing frame.

Using this method, to take all tables, from all schemas, the user
would need to run multiples queries, one for each schema.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Database Metadata proposal

2014-06-02 Thread Daniel Gaspary
On Mon, Jun 2, 2014 at 3:01 AM, LacaK la...@zoznam.sk wrote:
 IMO very similar result you can get also with existing implementation, when
 you use:

Yes, this is the way GetDBInfo do, but it's not public, and never
return schema. What I did was to copy and modify this method.

I have sent a patch: http://bugs.freepascal.org/view.php?id=26254
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Database Metadata proposal

2014-06-02 Thread Daniel Gaspary
On Mon, Jun 2, 2014 at 10:27 AM, LacaK la...@zoznam.sk wrote:
 (for SQLConnection which support schemas. I have used public method
 SetSchemaInfo not GetDBInfo)

It's not public in SqlConnection, it's public in SqlQuery.

Anyway, I don't see why avoid a dedicated method to do this instead of
3 steps which are not a clear.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Database Metadata proposal

2014-06-02 Thread Daniel Gaspary
On Mon, Jun 2, 2014 at 10:38 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
 While this is correct, the collection approach is much easier to use:
 With the metadataset, you must know which fields exist and type them
 correctly: FieldByName('XYZ').AsString

 With collections, the IDE codetools will tell you what properties exist.
 That is a order of magnitude more comfortable and less error prone.

Correct. And beyond the method, I have created the following const array:


 TSchemaObjectNames: array[TSchemaType] of String = ('???', 'table_name',
  '???', 'procedure_name', 'column_name', 'param_name',
  'index_name', 'package_name', 'schema_name');

To avoid this need for retyping field names, over and over.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Database Metadata proposal

2014-06-01 Thread Daniel Gaspary
On Sun, Jun 1, 2014 at 5:27 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
 Make this a TCollection/TCollectionItem. Generics are not used in the DB
 units, and they should not be used for consistency.

But I was thinking that TSqlObjectIdenfier could be reused at Data
Dictionary Units. As a TCollectionItem could be harder to reuse, as it
will depend of the existence of a TCollection.

Maybe using Record instead of a class?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Database Metadata proposal

2014-06-01 Thread Daniel Gaspary
On Sun, Jun 1, 2014 at 11:18 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
 But I was thinking that TSqlObjectIdenfier could be reused at Data
 Dictionary Units. As a TCollectionItem could be harder to reuse, as it
 will depend of the existence of a TCollection.

 I don't understand what you mean with this sentence ?

I was trying to say that I want to use the same
type(TSqlObjectIdenfier) in fpDatadict classes, like TDDTableDef.

 Though I don't see a problem with
 TCollectionItem/TCollection.
 It is used everywhere in the FCL.

I see no problem. It was just a wrong impression that I had about
TCollectionItem.

Thank You Michael.

   Daniel
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Database Metadata proposal

2014-06-01 Thread Daniel Gaspary
An Issue was created with the patch:

http://bugs.freepascal.org/view.php?id=26254


On Sun, Jun 1, 2014 at 11:28 AM, Daniel Gaspary dgasp...@gmail.com wrote:
 I see no problem. It was just a wrong impression that I had about
 TCollectionItem.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Database Metadata proposal

2014-05-31 Thread Daniel Gaspary
Hi.

   In December 2012, this[1] thread has brought some ideas about
Database metadata, in special the retrieving of Schema names.

   This[2] wiki page summarizes what was discussed.  Some further
conclusion after that thread?

   I agree that using Information schema, wherever is supported, is
the best solution.

   I propose the following types and methods:

TSqlObjectIdenfier = class
public
  property SchemaName: String;
  property ObjectName: String;

  //Optional / Reuse TSchemaType?
  property SqlObjectType: TSqlObjectType;
end;

TSqlObjectList = specialize TFPGListTSqlObjectIdenfier;

On TSQLConnection the new (virtual) methods bellow (similar to
GetDBInfo, but public) could be added:

  function GetObjectNames(ObjectType: TSchemaType):
TSqlObjectIdenfier; overload;
  function GetObjectNames(ObjectTypes: TSchemaTypes {A new Type
Set of TSchemaType}): TSqlObjectIdenfier;  overload;

  These changes would not affect Delphi compatibility, as I am
proposing to add, not replace what exists today.

  Ideas, Pros, cons.. ?

  Thank you,

 Daniel


[1] http://lists.freepascal.org/pipermail/fpc-pascal/2012-December/035844.html
[2] 
http://wiki.lazarus.freepascal.org/Database_metadata#Proposal_for_extension.2Funiformization
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] AnsiStrupper Error

2014-05-26 Thread Daniel Gaspary
On Mon, May 26, 2014 at 3:04 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:
 And that corruption is now caught: 
 http://wiki.freepascal.org/User_Changes_Trunk#Literal_storage_memory_has_been_made_read-only

Thank You, Jonas.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] AnsiStrupper Error

2014-05-25 Thread Daniel Gaspary
The code bellow is throwing an exception and I don't know why. It used to work.

program Project1;
uses
sysutils;
var
s : AnsiString;
begin
 s := 'a';
 AnsiStrupper(PAnsiChar(s));
end.

It works fine with FPC 2.6.4 (Linux x86-64 bits).

I'm using FPC trunk (Revision 27818):

An unhandled exception occurred at $00428E4D:
EAccessViolation: Access violation
  $00428E4D
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] From deflate to gzip

2014-04-01 Thread Daniel Gaspary
On Tue, Apr 1, 2014 at 4:12 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
 No, currently you need a file, unless you are willing to duplicate the
 tgzstream class using an in memory-approach.
 (that would be a welcome addition, BTW)

TZipper has similar problem, you cannot write direct to the destination file.

Months a go I worked to modify the class to have a Stream writing
directly to a zip file.

A complicated change, and I don't know if worth the effort because due
to Zip format[1], I realize that only streams with support to seek
back would be possible.

[1] The File Header is written before the compressed stream, and it
must contain the compressed file size.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] XMLWrite looses data

2014-03-24 Thread Daniel Gaspary
On Sun, Mar 23, 2014 at 2:58 PM, Graeme Geldenhuys
mailingli...@geldenhuys.co.uk wrote:
 I'm using FPC 2.6.2 under 64-bit FreeBSD, but will be compiling this
 application for Windows 32-bit and 64-bit tomorrow at work.

If you can, try also the Laz2_ XML units: Laz2_Dom, Laz2_xmlwrite and read.

They seem to work better with unicode or utf8 at least.

 Any idea what is causing this? A bug, because I'm using XSL or anything
 else maybe?

No idea, but maybe changing some parser option can help. The
Validating example shows how to change options:

http://wiki.freepascal.org/XML_Tutorial#Validating_a_document
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Issue 25114 needs to be assigned

2014-02-21 Thread Daniel Gaspary
Hi,

   Could someone assign the issue[1] to Sergei (Gorelkin)?

   I want to fix the problem, but I need his input on the subject.

   Thank you,

   Daniel

[1] http://bugs.freepascal.org/view.php?id=25114#c71108
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] gtree - Freeing a nil Root without error

2014-01-08 Thread Daniel Gaspary
On Wed, Jan 8, 2014 at 3:31 AM, leledumbo leledumbo_c...@yahoo.co.id wrote:
 As in the data structure theory, a tree is just a graph without cycle.
 So I guess it should be made that way. There are a lot of graph and tree
 variations though, so I think I need to take some time to design before
 implementing.

I don't know if the edges information can not be irrelevant and even
an obstacle to better performance in trees.

Anyway, good to know these plans.

Thank you.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] gtree - Freeing a nil Root without error

2014-01-07 Thread Daniel Gaspary
Hi,

   gtree.TTree type has the following code:

constructor TTree.Create;
begin
  FRoot := nil;
end;

destructor TTree.Destroy;
begin
  FRoot.Free;
end;


How is possible then that the following program don't raise an error
when the destructor (via free) is called?


program Project1;
{$mode objfpc}{$H+}
uses
  Classes, gtree;
type
TStrTree = specialize TTreeString;
var
   tt: TStrTree;
begin
 tt:=TStrTree.Create;
 if tt.Root = nil
 then
 WriteLn('Root is nil!');
 tt.Free;
end.

Thanks,

   Daniel
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] gtree - Freeing a nil Root without error

2014-01-07 Thread Daniel Gaspary
On Tue, Jan 7, 2014 at 6:27 PM, Marco van de Voort mar...@stack.nl wrote:
 Free only calls the destructor if self isn't nil.

Thank you, Marco.

I was searching in stl package for a Graph type. is there such type?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] gtree - Freeing a nil Root without error

2014-01-07 Thread Daniel Gaspary
On Tue, Jan 7, 2014 at 6:55 PM, Daniel Gaspary dgasp...@gmail.com wrote:
 Thank you, Marco.

 I was searching in stl package for a Graph type. is there such type?


Answering to myself...

I believe the Graph types exist only in Lazarus LazControls package,
unit LvlGraphCtrl.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Proposal for a XPath Namespace Resolver

2013-10-14 Thread Daniel Gaspary
On Sat, Oct 5, 2013 at 2:08 PM, Daniel Gaspary dgasp...@gmail.com wrote:
 Today the XPath Ns Resolver is marked as Experimental and is just an
 alias for TDomNode:

I have sent a patch:

http://bugs.freepascal.org/view.php?id=25183
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Helpers: Implementation Location influencing the result

2013-10-06 Thread Daniel Gaspary
On Sun, Oct 6, 2013 at 8:09 AM, Sven Barth pascaldra...@googlemail.com wrote:
 No. Whenever you call a method (either inside a class using (implicit) Self
 or outside using a variable) the compiler checks whether a helper for that
 type is in scope and uses that if it is. It has nothing to do with object
 instantiation (that would be more for Traits/Mixins:
 http://en.wikipedia.org/wiki/Trait_%28computer_programming%29 ).


Thank you, Sven.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Proposal for a XPath Namespace Resolver

2013-10-05 Thread Daniel Gaspary
(Let me know if bugtracker is better to discuss the idea)

Today the XPath Ns Resolver is marked as Experimental and is just an
alias for TDomNode:

  TXPathNSResolver = TDOMNode {!!! experimental}; [1]

The problem happens when the Namespace definition is not at the root
of the XML being processed:

root
  u1:e1 xmlns:u1=URI-1 u1:AnAttribute=AttValue/
  u2:e2 xmlns:u2=URI-2/
/root

Using

EvaluateXPathExpression('//@u1:AnAttribute', x.DocumentElement,
   x.DocumentElement);

(x is a TXmlDocument)

 Will raise an Exception due to the Resolver not being capable of
finding the URI when starting from root.

I think of something simple as:

TXPathNSResolver = class

   property CurrentNode: TDomNode; //Necessary??
   property xml: TXmlDocument;
   property OnNeedUri: TXPathNeedUriEvent;
end;

TXPathNeedUriEvent would be something like:

procedure (Sender: TXPathNSResolver; out AUri: String) of object;

Searching first at CurrentNode.lookupNamespaceURI and, if not found,
using OnNeedUri.

Ideas?

Should I post it at mantis, change, quit.. ?


[1] Line #352: 
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-xml/src/xpath.pp?view=markup
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Helpers: Implementation Location influencing the result

2013-10-05 Thread Daniel Gaspary
I have created an example to show the different results I got due to
where the implementation of a object is .

The code is at http://pastebin.com/wY2qmZFm

If you cut and paste the code block at Location A to the Location
B the result of the program changes.

At Location A the method of the helper is used. At Location B it is not.

My questions are

Is this right?

Why?


Thank you.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Helpers: Implementation Location influencing the result

2013-10-05 Thread Daniel Gaspary
On Sat, Oct 5, 2013 at 8:27 PM, Sven Barth pascaldra...@googlemail.com wrote:
 At location A the helper is not yet declared, thus GetAnotherString uses the
 GetString function of its own class. On location B the helper is already
 declared and thus the implementation of GetAnotherString will pick up the
 helper's GetString function instead.

I believed that the location that matters, in this case,  was only the
object instantiation (program/implementation body), because it was, in
both cases, after the helper declaration. A little weird.


Thanks, Sven.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] RFD: CardDAV support library for FreePascal, call for ideas

2013-09-25 Thread Daniel Gaspary
On Wed, Sep 25, 2013 at 8:03 AM, Lukasz Sokol el.es...@gmail.com wrote:
 Seems like the more complicated elements of DOM level 3 will need DOM.pas 
 modifications too.

What kind of modification ?

I have sent this patch [1] to allow create custom descendants of
TDomElement. You can check whether this could be useful to you.

I believe at least two more methods[2] need to be changed.

The patch is meant to modify dom.pas, but maybe I should have made it
to laz2_dom, as it seems to have more attention these days(being
update to UTF8 I Believe).

By the way, feedback (is a viable suggestion, no, why..?) on this
subject would be appreciated.


[1] http://bugs.freepascal.org/view.php?id=24860
[2] CreateElement and CreateElementBuf
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: RFD: CardDAV support library for FreePascal, call for ideas

2013-09-25 Thread Daniel Gaspary
On Wed, Sep 25, 2013 at 11:45 AM, Lukasz Sokol el.es...@gmail.com wrote:

 By the way, feedback (is a viable suggestion, no, why..?) on this
 subject would be appreciated.

 Of course I will give feedback when (and if) I get any.

I was talking about the dom/laz2_dom feedback.

But your feedback will be welcomed as well.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: RFD: CardDAV support library for FreePascal, call for ideas

2013-09-25 Thread Daniel Gaspary
On Wed, Sep 25, 2013 at 2:18 PM, Daniel Gaspary dgasp...@gmail.com wrote:
 I was talking about the dom/laz2_dom feedback.

I was talking about the dom/laz2_dom DEVELOPERS feedback.

(Just Correcting myself)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] RFD: CardDAV support library for FreePascal, call for ideas

2013-09-25 Thread Daniel Gaspary
Thank you for applying the patch, Michael.

As soon as I have some time I will send another one related to the same case.

On Wed, Sep 25, 2013 at 4:31 PM, Michael Van Canneyt
mich...@freepascal.org wrote:


 On Wed, 25 Sep 2013, Lukasz Sokol wrote:

 Hello,

 since I have not found anything on CardDAV related/written in/for
 FreePascal/Lazarus,
 (haven't googled with Delphi keyword thou)

 I'd like to send out some smoke signals, asking which way would the
 support for this kind of interaction (dare not call it a protocol)
 would be best fitting into FreePascal/Lazarus world.

 CardDAV itself is an extension of WebDAV and itself has its own RFC
 (RFC6532).

 I myself am trying to write a client connecting via CardDAV to a
 compatible server (built into my CRM, eGroupware) to request search and
 read
 addressbook entries.

 (it was the developers of the CRM in question indicated to me that XMLRPC
 is dead and support
 for it will be removed when they get a chance - that's why I'm doing
 this.)

 So far I got as far as copy/pasting example XML from the RFC and
 got a valid response from server, using THTTPSend from Synapse.
 http://wiki.freepascal.org/XML_Tutorial (and particularly the second
 XML2Tree procedure from
 http://wiki.freepascal.org/XML_Tutorial#Populating_a_TreeView_with_XML,
 with some mod of mine
 to not pass a TTreeView but a TTreeNodes object into it instead) came in
 handy to understand
 the structure of it.

 There are certain advantages of CardDAV over XMLRPC, which this post is
 too short to contain ;)

 I intend to keep it very simple at first, as it's enough for my purpose,
 to the point that the XML
 elements+attributes would be coded just as string concatenating operations
 and validated using
 TXMLDocument from dom.pas.
 Seems like the more complicated elements of DOM level 3 will need DOM.pas
 modifications too.

 But I'd like to know, if there is interest in making it 'more sentient',
 e.g. as
 a TDataSource/TDataSet descendant directly talking to (reading, at first)
 DOM.pas's
 TXMLDocument/TDOMDocument, then to a THTMLSend or any such class of your
 liking?


 I do not think that a TDataset descendent is needed. A simple collection
 based class will do just fine, and a class to handle transport.
 I have one for WebDAV, and CardDav really is not so much different.

 I also do not see why you would need alterations to DOM.pas, both WebDav and
 CardDav use plain and simple XML.

 BTW. The RFC is 6352 instead of 6532.

 Michael.

 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: RFD: CardDAV support library for FreePascal, call for ideas

2013-09-25 Thread Daniel Gaspary
On Wed, Sep 25, 2013 at 12:22 PM, Lukasz Sokol el.es...@gmail.com wrote:
 CalDAV itself is used on the CRM I use, but I've no demand for interacting
 with it. Yet.*

I have just taken a look at the RFC* and it seems simple to implement.

I don't need CardDav right now, but I believe I will need it soon.

Can you take (and share) CardDav samples needed on this CRM? They
could be useful.


* http://tools.ietf.org/html/rfc6352#page-4
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parser bug or what?

2013-09-15 Thread Daniel Gaspary
I cannot update my Environment at the moment, so I will just close the bug.

Thank you, Paul

On Sun, Sep 15, 2013 at 11:52 PM, Paul Ishenin paul.ishe...@gmail.com wrote:
 15.09.13, 21:14, Daniel Gaspary wrote:

 On Sun, Sep 15, 2013 at 6:37 AM, Sven Barth pascaldra...@googlemail.com
 wrote:

 Seems to be a bug related to scoped enums (in your example that would be
 TMyEnum.me1). Please report it as a bug with the example mentioned
 above
 as a file.


 Done: http://bugs.freepascal.org/view.php?id=25029


 Fixed in r25493. The fix also helped to find a bug in fpmake.pp which is
 used to compile a52 package.

 Thank you.

 Best regards,
 Paul Ishenin


 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Parser bug or what?

2013-09-14 Thread Daniel Gaspary
Can anybody tell me whether I stepped on a bug  or I am just
forgetting some Set / Enum property?

I made a Set to iterate with For..in, but I accidentally used a Dot
instead of a Comma between the elements.

The result was that the For sees only the item(s) after the Dot as the Example

What's Happening in the example ??

program Project1;
type
TMyEnum = (me1, me2, me3);
TMyEnumSet = set of TMyEnum;
var
   e: TMyEnum;
begin
 for e in [me1 . me2] do  //It's a dot, not a comma
 WriteLn(e);
end.

It works with other combinations, like:

[me1 . me2. me3.]  // DOT DOT DOT
[me1 , me2. me3.]  // COMMA DOT DOT

My FPC version: 2.7.1 [2013/03/26] for x86_64
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] class of variables typecasts

2013-08-22 Thread Daniel Gaspary
 learn about class references (i.e. class of declarations) and
constructors.

Since class of was on topic of other thread...

Is possible(How?) to perform typecasts like:

AClassType(obj); ??

Example:

type
TClass1 = class(TObject);
TClass2 = class(TClass1);
TClass3 = class(TClass1);
TClassType = class of TClass1;
procedure DoSomething(AClassType: TClassType; obj: TClass1);
begin
AClassType(obj).RunAMethod(...); //Wrong, it is typecasting to
class of, I believe
end;

The obj as AClassType kind I know it works.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Failed manual page

2013-03-21 Thread Daniel Gaspary
The page Command-line options and switches Reference chart.. [1]
referenced at Manuals page[2] seems to be buggy.

[1] http://www.freepascal.org/docs-html/chart/chart.html
[2] http://www.freepascal.org/docs-html/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] a proposal about with syntax

2013-03-16 Thread Daniel Gaspary
On Sat, Mar 16, 2013 at 3:02 PM, 印場 乃亜 shir...@galapagossoftware.com wrote:
 With BigLongThingIDontWantToWriteOutEverySingleTime do
   begin
  Height := 100;
  Width := 200;
 ...
  SomeOtherObject.Submit(BigLongThingIDontWantToWriteOutEverySingleTime);
   end;

 Notice how I have to write the long thing out again at the bottom.  There
 must be a way around that (Something like Self, but that refers to
 whatever you are using in With).

You can use a Class Helper:

http://pastebin.com/pFL49byh

But you gonna need to use a type cast. And with a SomethingElse at
the with, as showed by Xiangrong, things can become messy.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] a proposal about with syntax

2013-03-16 Thread Daniel Gaspary
On Sat, Mar 16, 2013 at 7:55 PM, Xiangrong Fang xrf...@gmail.com wrote:
 I don't think a class helper is worth for this stuff, if I need to write a
 helper I would rather do this:

I am not sure that I understand your point.

The Class helper was a way to show how it's possible. And with that
helper, ALL objects could use it's method. You could use it as
library.

 why adding an as to make it more convenient a bad idea?

I don't mean that. The Type cast is necessary in my solution, just that.

  I don't know what's make it complex if there are 2 or more subject in the 
 with?

Context. A conflict case the two object were of the same class.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] a proposal about with syntax

2013-03-16 Thread Daniel Gaspary
On Sun, Mar 17, 2013 at 12:07 AM, 印場 乃亜 shir...@galapagossoftware.com wrote:
 On 2013/03/17, at 11:37, Flávio Etrusco flavio.etru...@gmail.com wrote:
 Daniel, I find this hack as ingenious as atrocious ;-)
 But thinking about it a bit, when FPC gets generic methods you can
 make this kind of workable!

I was thinking about this, not specifically generic methods, but some
new generic resource.


 No comment, but the fact that he replied with his solution so quickly makes 
 me wonder if he has actually used it before!

I never used it, but indeed I have thought before about a way to do this.

I would like to have option to use a kind of self in with statement,
but I understand the compiler team that it is a superfluous resource.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Daniel Gaspary
Using Xpath I believe would be something like this:

function ElementById(id: string; doc: TXMLDocument): TDOMElement;
var
   v: TXPathVariable;
begin
 result:=nil;
 try
v:=EvaluateXPathExpression('//*[@id=' + QuotedStr(id)+']',
 doc.DocumentElement);

result:=TDOMElement(v.AsNodeSet[0]);
 finally
FreeAndNil(v);
 end;
end;

On Tue, Mar 12, 2013 at 10:42 AM,  dev.d...@gmail.com wrote:
 A little side note to my statement:
 and I don't have a DTD

 In this case the behaviour of the parser is even right...

 W3C:
 Note: Attributes with the name ID or id are not of type ID unless so
 defined
 --
 http://stackoverflow.com/questions/3423430/java-xml-dom-how-are-id-attributes-special

 But that's not the solution to my problem... :(
 d.l.i.w
 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Daniel Gaspary
On Tue, Mar 12, 2013 at 11:17 AM, Daniel Gaspary dgasp...@gmail.com wrote:
 Using Xpath I believe would be something like this:

I was missing an If:

function ElementById(id: string; doc: TXMLDocument): TDOMElement;
var
   v: TXPathVariable;
begin
 result:=nil;
 try
v:=EvaluateXPathExpression('//*[@id=' + QuotedStr(id)+']',
 doc.DocumentElement);

with v.AsNodeSet do
begin
 if Count0
 then
 result:=TDOMElement(Items[0]);
end;
 finally
FreeAndNil(v);
 end;
end;
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Set size limit

2013-03-11 Thread Daniel Gaspary
On Mon, Mar 11, 2013 at 7:09 AM, Mark Morgan Lloyd
markmll.fpc-pas...@telemetry.co.uk wrote:
 That was pretty much my gist. Since these days Unicode is larger than 65536
 codepoints I don't think there's any advantage to expanding sets from 256 to
 65536 elements, efficient operations on sparse arrays of 256-element sets
 would be far better.

In my case the enum has near 600 elements.

TMyEnum = (me1, me2...);

The set though would never be used to contain more than 256.

TMySet = set of TMyEnum;

Is it not viable to modify the compiler to compile the code and raise
an exception if I try to add more than 256 elements to the set ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Set size limit

2013-03-11 Thread Daniel Gaspary
On Mon, Mar 11, 2013 at 10:43 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:
 A set is basically a bitpacked array of boolean. Element X is set to true if
 you add X to the set, and to false if you remove it again. That means that
 if you have a set with 600 possible values, you need at least 600 bits,
 regardless of how many elements are inside it.

 The above also shows an alternative to sets in that case: you can use a
 bitpacked array[TMyEnum] of boolean instead. Of course, then you can't use
 the regular set operators.

 Jonas

Your explanation made the implementation problem clear to me. And the
alternative is interesting.

Thank you.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Set size limit

2013-03-10 Thread Daniel Gaspary
On Sun, Mar 10, 2013 at 11:12 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:
 For larger sets, especially if they are sparse, a simple hashtable-based class
 would probably be much faster and memory efficient

Just some background..

I was using a Set because I needed a initialized constant container
with a variable length.

It was a array of records, the set would be one of the fields. I
believe it's not possible to have dynamic array initialized inside
records.

TMyRecord = record
   TheSet: TMySet;
end;

const
MyArray: array[TMyEnum] of TMyRecord = ( (TheSet: [me1, me3]),
(TheSet: [me2, me1]) );

Now I have changed the code to a function with a case returning the record.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Set size limit

2013-03-09 Thread Daniel Gaspary
Hi,

   I am trying to create a Set Type...

   TMyEnum = (me1, me2, me3); // more than 500 elements

   TMySet = set of TMyEnum;

...but I get the following error:

Error: illegal type declaration of set elements [1]

The problem seems to be that TMyEnum has more than 256 elements.

Can I specify such Set with some compiler option ?

My fpc is pre 2.6, any change on new versions concerning Sets limits?

Thanks.

[1] A more specific message would help too. :)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Virtual Constants

2013-03-03 Thread Daniel Gaspary
On Sun, Mar 3, 2013 at 11:13 AM, Joao Morais jcmorai...@gmail.com wrote:
 Afaik no, but you can override class virtual methods which might give
 you the correct value:

Exactly what I was trying to avoid. :)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Virtual Constants

2013-03-01 Thread Daniel Gaspary
The idea is strange. But here it is:

Is possible to have a Class constant with different values in class
descendants ?

Would be something like that:

TA = class
const
c1: integer; virtual;

class function GetC1: integer; //returns c1
end;

TB = class(TA)
const
c1: integer = 1;
end;

TC = class(TA)
const
c1: integer = 2;
end;
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] abstract classes

2013-01-21 Thread Daniel Gaspary
On Mon, Jan 21, 2013 at 10:59 PM, Graeme Geldenhuys
gra...@geldenhuys.co.uk wrote:
 As I said in the other thread - it is a bug! Completely defeats the
 design principal of what abstract class or method means.

 FPC should raise an error. I don't care what Delphi does - it's wrong.

I agree, it's awkward to just let the compiling proceed with code that
can cause avoidable errors at runtime.

What about letting this behavior as is ONLY for the delphi mode and
abort compiling for objfpc ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Unit testing aid...

2012-08-22 Thread Daniel Gaspary
On Wed, Aug 22, 2012 at 2:08 PM, Michael Van Canneyt
mich...@freepascal.org  I would appreaciate feedback and
suggestions.

I believe could be interesting to have a similar tool to generate
annotations to a unit(or set of units).

The obvious example: insert calls to logging procedures at the enter
and exit of each method, procedure or function of a unit.

With options to specify targets (all procedures, name some, etc... )
and templates to insert.

But anyway, thank you for these two tools, the pas2ut in special I
believe will be very helpful.

  Daniel
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] [OT] GPL Lisence help

2012-07-27 Thread Daniel Gaspary
On Fri, Jul 27, 2012 at 5:39 PM, Dimitrios Chr. Ioannidis
d.ioanni...@nephelae.eu wrote:
 Hi all,

   first let me express my apologies for the off topic question.

   I'm having trouble to choose the correct gpl lisence for a new open
 source project that i'm starting. I want the project to be open source
 gpl'ed so it can be accepted in distro's like Debian. But, at the same
 time, because the structure is modular, i want the possibility, to be
 used by anyone in commercial applications.

   Can anyone give a hint and/or a suggestion ?

How about Dual licensed ?

Let people choose the license: GPL or MIT
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] DOM and namespaces with prefix

2012-06-22 Thread Daniel Gaspary
On Tue, Jun 19, 2012 at 10:11 AM, Torsten Bonde Christiansen
t...@epidata.info wrote:
  DDIInstance := XMLDoc.CreateElementNS('ddi:instance:3_0', 'DDIInstance');
  DDIInstance.Prefix := 'ns1';        // this gives me: ns1:DDIInstance
 xmlns:ns1=ddi:instance:3_0 which is great.

  // now I would like to expand with eg: xmlns:a=ddi:archive:3_0
  Attr := XMLDoc.CreateAttributeNS('ddi:archive:3_0', 'huh');
  Attr.Prefix := 'a';
  DDIInstance.SetAttributeNode(Attr);   // but this gives: ns1:DDIInstance
 xmlns:ns1=ddi:instance:3_0 xmlns:a=ddi:archive:3_0 a:huh=/

 How can i get the xmlns:a=ddi:archive:3_0 without the additional
 attribute AND maintain the namespace + prefix in later elements?

I believe that the solution(given by Sergei Gorelkin at [1]) is:

DDIInstance.SetAttributeNS('ddi:archive:3_0','xmlns:a','ddi:archive:3_0');

[1] http://bugs.freepascal.org/view.php?id=22299#c60652
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] DOM and namespaces with prefix

2012-06-21 Thread Daniel Gaspary
On Tue, Jun 19, 2012 at 10:11 AM, Torsten Bonde Christiansen
t...@epidata.info wrote:
 How can i get the xmlns:a=ddi:archive:3_0 without the additional
 attribute AND maintain the namespace + prefix in later elements?

Hi.

It's hard to test without a (small please) comlete XML example because
the NS attribute is added when it's needed. So, you need to add an
attribute or a child element that uses the Namespace.

The XML below is created with the modfied program ahead. But I believe
a method to create a namespace attribute would be useful.


?xml version=1.0 encoding=utf-8?
ns1:DDIInstance xmlns:ns1=ddi:instance:3_0
  a:AnAELement xmlns:a=ddi:archive:3_0
a:AnotherAELement a:MyAtt=A value/
  /a:AnAELement
/ns1:DDIInstance



program project1;
{$mode objfpc}{$H+}

uses
 Classes, DOM, XMLWrite;

const
 cArchive = 'ddi:archive:3_0';
var
 XMLDoc: TXMLDocument;
 DDIInstance: TDOMElement;
 AnAElement, AnotherAElement: TDOMElement;

begin
 XMLDoc := TXMLDocument.Create;
 DDIInstance := XMLDoc.CreateElementNS('ddi:instance:3_0', 'DDIInstance');
 DDIInstance.Prefix := 'ns1';// this gives me:
ns1:DDIInstance xmlns:ns1=ddi:instance:3_0 which is great.

 //Here a New element using the Namespace that will be created.
 AnAElement:=XMLDoc.CreateElementNS(cArchive, 'a:AnAELement');
 DDIInstance.AppendChild(AnAElement);

 //Another element of the same namespace, child of the prior, no
Namespace creation
 //needed
 AnotherAElement:=XMLDoc.CreateElementNS(cArchive, 'a:AnotherAELement');
 AnAElement.AppendChild(AnotherAElement);

 //The same as above, but with an Attribute
 AnotherAElement.SetAttributeNS(cArchive, 'a:MyAtt', 'A value');

 Xmldoc.AppendChild(DDIInstance);

 WriteXMLFile(XMLDOc, '/tmp/test.xml');
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] DOM and namespaces with prefix

2012-06-21 Thread Daniel Gaspary
I have created a bug report[1] with an example of malformed file.

[1] http://bugs.freepascal.org/view.php?id=22299

On Thu, Jun 21, 2012 at 3:51 PM, Daniel Gaspary dgasp...@gmail.com wrote:
 On Tue, Jun 19, 2012 at 10:11 AM, Torsten Bonde Christiansen
 t...@epidata.info wrote:
 How can i get the xmlns:a=ddi:archive:3_0 without the additional
 attribute AND maintain the namespace + prefix in later elements?

 Hi.

 It's hard to test without a (small please) comlete XML example because
 the NS attribute is added when it's needed. So, you need to add an
 attribute or a child element that uses the Namespace.

 The XML below is created with the modfied program ahead. But I believe
 a method to create a namespace attribute would be useful.


 ?xml version=1.0 encoding=utf-8?
 ns1:DDIInstance xmlns:ns1=ddi:instance:3_0
  a:AnAELement xmlns:a=ddi:archive:3_0
    a:AnotherAELement a:MyAtt=A value/
  /a:AnAELement
 /ns1:DDIInstance



 program project1;
 {$mode objfpc}{$H+}

 uses
  Classes, DOM, XMLWrite;

 const
     cArchive = 'ddi:archive:3_0';
 var
  XMLDoc: TXMLDocument;
  DDIInstance: TDOMElement;
  AnAElement, AnotherAElement: TDOMElement;

 begin
  XMLDoc := TXMLDocument.Create;
  DDIInstance := XMLDoc.CreateElementNS('ddi:instance:3_0', 'DDIInstance');
  DDIInstance.Prefix := 'ns1';        // this gives me:
 ns1:DDIInstance xmlns:ns1=ddi:instance:3_0 which is great.

  //Here a New element using the Namespace that will be created.
  AnAElement:=XMLDoc.CreateElementNS(cArchive, 'a:AnAELement');
  DDIInstance.AppendChild(AnAElement);

  //Another element of the same namespace, child of the prior, no
 Namespace creation
  //needed
  AnotherAElement:=XMLDoc.CreateElementNS(cArchive, 'a:AnotherAELement');
  AnAElement.AppendChild(AnotherAElement);

  //The same as above, but with an Attribute
  AnotherAElement.SetAttributeNS(cArchive, 'a:MyAtt', 'A value');

  Xmldoc.AppendChild(DDIInstance);

  WriteXMLFile(XMLDOc, '/tmp/test.xml');
 end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] have anyone binded librsync to pascal yet ?

2012-05-25 Thread Daniel Gaspary
On Fri, May 25, 2012 at 6:55 AM, ik ido...@gmail.com wrote:
 Hello,

 Is there anyone who binded librsync into Pascal/FPC ?

 Thanks,

 Ido

Last week I have googled about it and found no results.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to use pam?

2012-02-06 Thread Daniel Gaspary
On Mon, Feb 6, 2012 at 14:37, Mattias Gaertner
nc-gaert...@netcologne.de wrote:
 Hi,

 I need to authenticate user name and password under Linux. These are normal
 accounts so I guess libpam is the weapon of choice. But I can't find any
 pam binding in the FPC sources.

 Is there a better way or has really no one yet used pam with fpc?


At [1] there's a good recipe of how to implement a PAM login app, I
believe it could be an interesting point to start a fpc binding.

[1] http://www.ibm.com/developerworks/linux/library/l-pam/index.html
 (search for 10 steps to designing a simple PAM login app)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] detecting if a socket is open in synapse

2012-01-21 Thread Daniel Gaspary
On Sat, Jan 21, 2012 at 09:28, ik ido...@gmail.com wrote:
 Hello,

 How can I detect if a tcp socket is open or not in synapse ?

Trying to send and detecting if an error was raisen:

http://www.ararat.cz/synapse/doku.php/public:howto:activeconnection
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Redis client for object Pascal

2012-01-21 Thread Daniel Gaspary
On Fri, Jan 20, 2012 at 18:18, ik ido...@gmail.com wrote:
 The code is released under LGPL 3. I do wish to allow open/free and
 commercial usage, but to
 have any changes, additions etc, contribute back for everyone.

With LGPL (non modified) the only (commercial, closed) way to use the
project is with DLL's. Am I misinterpreting the LGPL?

Anyway, thanks for the great work .
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] detect the version of fpc that a feature added to it

2012-01-19 Thread Daniel Gaspary
On Thu, Jan 19, 2012 at 17:17, ik ido...@gmail.com wrote:
 Another question, should I open a bug for documentation, to add when a
 specific feature like so was added in the documentation itself ?

Do This issue cover this topic?

http://bugs.freepascal.org/view.php?id=15492
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Advanced Records - Why not available by default?

2012-01-15 Thread Daniel Gaspary
On Sun, Jan 15, 2012 at 04:43, J.-c. Chu jc...@acm.org wrote:
 For one thing, class variables, class methods, and class properties are
 subject to visibility controls and inheritance.

 So you can, for example, have a private class variable initialized with
 class constructor (which avoids code in the INITIALIZATION section) and
 accessed via a read-only class property (which is impossible with
 unit-level variables).

Interesting, thank you for share this use case.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Advanced Records - Why not available by default?

2012-01-15 Thread Daniel Gaspary
On Sun, Jan 15, 2012 at 11:44, J.-c. Chu jc...@acm.org wrote:
 There is a listing, despite not up-to-date, of new language features
 since Delphi 7, at http://edn.embarcadero.com/article/34324.  Not all
 of them are currently implemented in FPC.

I believe could be really useful to have a grid style in just one page
with compability status.

Is there something similar to this page at fpc wiki ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Advanced Records - Why not available by default?

2012-01-14 Thread Daniel Gaspary
On Sat, Jan 14, 2012 at 21:59, Lars nore...@z505.com wrote:
 Personally, I'm getting sick of all the new features added to delphi that
 don't add anything meaningful, and just add complexity to the compiler.

I agrre with you. I like some features of advanced records.

But a lot of things seems a big redundancy.

The possibility of class vars specially surprised me ? For What
purpose that could be good for ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Advanced Records - Why not available by default?

2012-01-13 Thread Daniel Gaspary
Any special reason to Advanced Records be available only in Delphi Mode ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Redis client for FPC

2012-01-11 Thread Daniel Gaspary
On Wed, Jan 11, 2012 at 15:32, ik ido...@gmail.com wrote:
 Here is a new request for the new year/version of FPC :)

 Additional way beside dataset to control databases, even if they are not
 table/structure based.

A Redis specialized TDatasource Descendant Could work. Is there any
problem with this aproach?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to get path to current theme icons on linux?

2012-01-10 Thread Daniel Gaspary
On Mon, Jan 9, 2012 at 18:45, Krzysztof dib...@wp.pl wrote:
 I need to load icon associated by file extension. On windows I done
 this by WinAPI function ExtractAssociatedIcon(). On linux is not so
 easy, because we have GNOME, KDE, XFCE, LXDE etc, but I noticed that
 icons are stored in this same place

I believe that file/dir locations are ruled by freedesktop
specifications.I have found this:

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#s2_layout
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] XML - How to set and use a Namespace Prefix?

2011-10-28 Thread Daniel Gaspary
I'm trying to create an XML Document with multiple Namespaces.

With the code below[1] a get as result the following XML:

svg xmlns=http://www.w3.org/2000/svg; /

How can I set a second Namespace, should I use SetAttribute or
SetAttributeNS ? :

root.setattribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');

?

Can anybody give me an example when setAttributeNS is useful ?

Is there a way to, after setting a namespace prefix, make all
attributes and elements to be added using it ?

Thanks


[1]
var
   Doc: TXMLDocument;
   root, node: TDOMElement;
begin
 Doc:=TXMLDocument.Create;

 root:=Doc.CreateElementNS('http://www.w3.org/2000/svg', 'svg');
 Doc.AppendChild(root);
...
end;
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] sdlutils on linux 64 bits

2011-08-01 Thread Daniel Gaspary
Hi,

I was trying to run the example from [1], but I have noticed
fpcmake from sdl package does not compile sdlutils for my environment,
Linux (ubuntu 11.04) 64 bits.

   sdlutils is the only unit with restrictions in fpmake.pp . Tyring
to compile myself I got errors like the following:

   Typecast has different size (4 - 8) in assignment

   PUInt8( Addr )^ := R or G or B;

   The last activity on this unit seems to be from 2008. Any new
solution or workaround to make the code compatible ?


   Thanks.


[1] 
http://www.pascalgamedevelopment.com/content.php?15-Artillery-Game-Tutorial-Part-1-Introduction
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal