Re: [fpc-pascal] Printing TFPImage to TCairoPSCanvas

2018-05-21 Thread Leonardo M . Ramé via fpc-pascal

On Mon, 21 May 2018, Leonardo M. Ramé via fpc-pascal wrote:

> Hi, I need to print an TFPMemoryimage into Printer.Canvas (which uses
> TCairoPSCanvas to printing to CUPS) from a Linux CGI (no widgetset), but
> it seems that it's an impossible task, because Printer.Canvas requieres a
> TBitmap which in turn requires a widgetset.  Can anyone help me with
> this?.
>
> BTW, can fpReport print to a Printer? all the examples "exports" to PDF and 
> other formats, but none of them is sending directly the report to a printer.


If you use the LCL, it uses the printer canvas.

A FPImage PostScript canvas exists, but it's largely untested. In theory,
this could be used to create a postscript file and that could be sent
directly to cups.

Michael.

Hi Michael, do you mean TPostscriptCanvas from PSCanvas.pp?, that doesn't seem 
to have a way to render a bitmap.

I think I must send my bitmap to imagemagick's convert to create the Postscript 
file, then use lpr to send it to the printer.

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

[fpc-pascal] Printing TFPImage to TCairoPSCanvas

2018-05-21 Thread Leonardo M . Ramé via fpc-pascal
Hi, I need to print an TFPMemoryimage into Printer.Canvas (which uses 
TCairoPSCanvas to printing to CUPS) from a Linux CGI (no widgetset), but it 
seems that it's an impossible task, because Printer.Canvas requieres a TBitmap 
which in turn requires a widgetset.
Can anyone help me with this?. 

BTW, can fpReport print to a Printer? all the examples "exports" to PDF and 
other formats, but none of them is sending directly the report to a printer.
Regards,Leonardo.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpc and voip ?

2017-02-02 Thread Leonardo M . Ramé
Hi freedvs, does it mean with UOS I can create an audio streaming server via 
HTTP?.
Regards,
Leonardo M. Ramé 
http://leonardorame.blogspot.com

  From: fredvs 
 To: fpc-pascal@lists.freepascal.org 
 Sent: Thursday, February 2, 2017 10:19 AM
 Subject: Re: [fpc-pascal] fpc and voip ?
   
Hello.

I am happy to announce that uos does internet-streaming with opus files.
Take a look at conswebstream and simplewebplayer demos.

https://github.com/fredvs/uos

Here demo (ok, the sound is not perfect because the video recorded the sound
from the mic, but in real the sound is perfect):

https://sites.google.com/site/fredvsbinaries/uos_opus_web.mp4

Enjoy.

Fre;D






-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpc-and-voip-tp5727307p5727556.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] fpGUI Features

2015-06-17 Thread Leonardo M . Ramé
Hi Graeme, I know you hate web stuff, but did you take a look at this? 
http://www.zebkit.com/
  
Its something similar to your approach with fpGui, but using HTML5 Canvas, I'm 
dreaming of seeing fpGui on the web, generated from FPC.
 Leonardo M. Ramé
http://leonardorame.blogspot.com
  From: Graeme Geldenhuys 
 To: fpc-pascal@lists.freepascal.org 
 Sent: Wednesday, June 17, 2015 5:20 AM
 Subject: Re: [fpc-pascal] fpGUI Features
   
On 2015-06-17 04:26, Horacio Jamilis wrote:
> Does it support Android on any way?

I once heard somebody was working on a port, but I can't remember who
that was. If LCL-Customdrawn could do it, then it must be possible with
fpGUI too. I unfortunately don't know anything about Android development
yet.

> enaught to me (the edit control does not work as good as I expected).

No surprise really. The LCL-Customdrawn widgetset is still in Alpha
state, and it needs a lot more development effort before it is usable
even on a desktop environment. There are a lot of things still missing.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal


http://fpgui.sourceforge.net/
___
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] Solution for Timer in daemon

2013-03-01 Thread Leonardo M . Ramé


>
> From: Krzysztof 
>To: fpc-pascal  
>Sent: Friday, March 1, 2013 3:10 PM
>Subject: [fpc-pascal] Solution for Timer in daemon
> 
>
>Hi,
>
>
>I'm reading that I can't use timer in daemon because daemon core is based on 
>thread. So I'm trying to create another thread which simulate timer. My 
>interval is quite big (~1-5 minutes), so I can't just use sleep(6) because 
>daemon will hung on terminate. So I have two ideas:
>
>
>1. Create loop with short sleep(1000) which on each loop check if main 
>interval occur and check if daemon is terminated
>2. Create loop with RTL event with RtlEventWaitFor(Event, 6) and daemon on 
>terminate just send event to worker so it immediately exit.
>
>
>What is the best efficient solution? Maybe exists another way?
>
>
>Regards.

Well, as far as I know, sleep is no thread safe, it will block your app.



Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] OT a bit - Planet Object Pascal

2013-02-17 Thread Leonardo M . Ramé
>
> From: ik 
>To: FPC-Pascal users discussions  
>Sent: Sunday, February 17, 2013 5:30 PM
>Subject: Re: [fpc-pascal] OT a bit - Planet Object Pascal
> 
>
>I don't need an IDE to develop Pascal, unlike Java for example, I can use VIM
>(and actually sometimes do), to develop. A language that must be with IDE
>sucks big time.

Whaaat? I don't like java, but don't you know you can use javac command line?, 
and program in any text editor?.


Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Re: Tree structure

2013-02-13 Thread Leonardo M . Ramé


>
> From: Roberto P. 
>To: Leonardo M. Ramé ; FPC-Pascal users discussions 
> 
>Sent: Wednesday, February 13, 2013 11:27 AM
>Subject: Re: [fpc-pascal] Re: Tree structure
> 
>
>I can't find the unit gtree...where is it located or downloadable from ?
>
>
>Thanks,
>
>

In /packages/fcl-stl/src you'll have to update your svn trunk 
repository. 


Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Re: Tree structure

2013-02-13 Thread Leonardo M . Ramé
- Original Message -

> From: leledumbo 
> To: fpc-pascal@lists.freepascal.org
> Cc: 
> Sent: Wednesday, February 13, 2013 10:14 AM
> Subject: [fpc-pascal] Re: Tree structure
> 
> Ah... finally somebody needs it. Please use the gtree unit, I would like to
> see whether it's really worth developing the unit for other people (than
> myself) :)
> 
> 

Hi Leledumbo, I think it will work. I take the opportunity to ask you for a 
little example on how can I traverse a nested tree, I need this for populating 
a TTreeView from a generic TTree.


 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Leonardo M . Ramé
- Original Message -

> From: Leonardo M. Ramé 
> To: FPC-Pascal users discussions 
> Cc: 
> Sent: Tuesday, February 12, 2013 12:45 PM
> Subject: Re: [fpc-pascal] Tree structure
> 
> - Original Message -
> 
>>  From: Michael Van Canneyt 
>>  To: Leonardo M. Ramé ; FPC-Pascal users 
> discussions 
>>  Cc: 
>>  Sent: Tuesday, February 12, 2013 12:28 PM
>>  Subject: Re: [fpc-pascal] Tree structure
>> 
>> 
>> 
>>  On Tue, 12 Feb 2013, Leonardo M. Ramé wrote:
>> 
>>>   Hi, I would like to know if there's a standard tree structure 
> where 
>>  each node is a TObject. With "standard" I mean, in a standard 
> package, 
>>  like fcl-base.
>> 
>>  there is one in the generics.  But not as a regular class.
>> 
>>  Michael
> 
> 
> Which one?.
> 
> 

Well, I think TAvlTree fits the bill.


 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Leonardo M . Ramé
- Original Message -

> From: Michael Van Canneyt 
> To: Leonardo M. Ramé ; FPC-Pascal users discussions 
> 
> Cc: 
> Sent: Tuesday, February 12, 2013 12:28 PM
> Subject: Re: [fpc-pascal] Tree structure
> 
> 
> 
> On Tue, 12 Feb 2013, Leonardo M. Ramé wrote:
> 
>>  Hi, I would like to know if there's a standard tree structure where 
> each node is a TObject. With "standard" I mean, in a standard package, 
> like fcl-base.
> 
> there is one in the generics.  But not as a regular class.
> 
> Michael


Which one?.

 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Leonardo M . Ramé
>
> From: Michael Van Canneyt 
>To: FPC-Pascal users discussions  
>Sent: Tuesday, February 12, 2013 12:36 PM
>Subject: Re: [fpc-pascal] Tree structure
> 
>
>
>On Tue, 12 Feb 2013, Torsten Bonde Christiansen wrote:
>
>> On 2013-02-12 16:13, Leonardo M. Ramé wrote:
>>       Hi, I would like to know if there's a standard tree structure where 
>>each node is a TObject. With "standard" I mean, in a standard package, like
>>       fcl-base.
>> 
>>  
>> Leonardo M. Ramé
>> http://leonardorame.blogspot.com
>> 
>> 
>> FCL_base does have one: avl_tree
>
>Does not allow multiple children, only left/right, no ?
>
>Michael.


Isn't that a balanced binary tree? I'm looking for a simple tree structure 
(http://en.wikipedia.org/wiki/Tree_%28data_structure%29)


Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] TFPCanvasDrawer and anti-alias.

2013-01-28 Thread Leonardo M . Ramé
>
> From: silvioprog 
>To: Leonardo M. Ramé ; FPC-Pascal users discussions 
> 
>Sent: Monday, January 28, 2013 9:20 PM
>Subject: Re: [fpc-pascal] TFPCanvasDrawer and anti-alias.
> 
>
>2013/1/28 Leonardo M. Ramé 
>
>[...]
>>Silvio, TAchart has a BGRABitmap backend mode, it creates great anti-aliased 
>>graphics (both lines and text). I didn't tested on CGI without linking 
>>against graphic libraries, I think it relies on TCanvas, so maybe it won't 
>>work, but it worth a try.
>>
>>
>>Leonardo M. Ramé
>>http://leonardorame.blogspot.com
>___
>fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>  
svn co svn://svn.code.sf.net/p/lazpaint/code/bgrabitmap

Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] TFPCanvasDrawer and anti-alias.

2013-01-28 Thread Leonardo M . Ramé
- Original Message -

> From: Graeme Geldenhuys 
> To: fpc-pascal@lists.freepascal.org
> Cc: 
> Sent: Monday, January 28, 2013 9:15 PM
> Subject: Re: [fpc-pascal] TFPCanvasDrawer and anti-alias.
> 
> On 01/28/13 23:32, silvioprog wrote:
>>>  Not for lines.
>> 
>> 
>>  Sniff. :'(
>> 
>>  I'm trying to generate charts in my CGI apps:
> 
> 
> Use AggPas. That is exactly why I incorporated it into fpGUI. I needed
> anti-aliased line drawing for graphs etc.
> 
> 


Yes, that's a nice backend for TAchart.

Also you could generate your charts in the browser, using a JavaScript/Html5 
library like this one: http://www.humblesoftware.com/flotr2/

 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] TFPCanvasDrawer and anti-alias.

2013-01-28 Thread Leonardo M . Ramé
>
> From: silvioprog 
>To: FPC-Pascal users discussions  
>Sent: Monday, January 28, 2013 8:32 PM
>Subject: Re: [fpc-pascal] TFPCanvasDrawer and anti-alias.
> 
>
>2013/1/28 Michael Van Canneyt 
>On Mon, 28 Jan 2013, silvioprog wrote:
>>
>>Hello,
>>>TFPCanvasDrawer provides  anti-alias support?
>>>
>>
Not for lines.
>
>
>Sniff. :'(
>
>
>I'm trying to generate charts in my CGI apps:
>
>
>http://silvioprog.com.br/cgi-bin/cgi1
>
>
>And PDF with PowerPDF (I'll send a patch soon to remove some LCL dependences):
>
>
>http://silvioprog.com.br/cgi-bin/cgi2 (Clique "aqui" = Click "here")
> 
>For texts, it should be able to add it.
>>
>Yes:
>
>
>procedure TFPCanvasDrawer.EnsureFont;
>begin
>  {$IFDEF USE_FTFONT}
>  if FFont <> nil then exit;
>  FFont := TFreeTypeFont.Create;
>  FFont.Resolution := 72;
>  FFont.AntiAliased := False; <<<< I'll set it for True. It would be 
>interesting if there was a property to handle it.:)
>  FCanvas.Font := FFont;
>  {$ENDIF}
>end;
>
>
>Thanks for the fast reply man! :)
>
>
>
>ps. I'm very, very happy with the Free Pascal. Now, I'm creating fine my PDFs 
>and charts. I will make one layer to facilitate the use of some classes of 
>PowerPDF and TAChart.
>
>


Silvio, TAchart has a BGRABitmap backend mode, it creates great anti-aliased 
graphics (both lines and text). I didn't tested on CGI without linking against 
graphic libraries, I think it relies on TCanvas, so maybe it won't work, but it 
worth a try.


Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Favourite Pascal books

2013-01-22 Thread Leonardo M . Ramé


- Original Message -

> From: Patrick 
> To: fpc-pascal@lists.freepascal.org
> Cc: 
> Sent: Monday, January 21, 2013 3:51 PM
> Subject: [fpc-pascal] Favourite Pascal books
> 
> Hi Everyone
> 
> I am just putting together an order for abebooks. They have a million and one 
> Pascal books. I can't decide on which ones to buy.
> 
> Could you let me know what your favourite Pascal books are? -Patrick
> 

The best introductory Turbo Pascal book I've ever read was "Mastering Turbo 
Pascal 6" from Scott D. Palmer spanish edition, I remember how amazed I was 
after learning how pointers work, and how fast my apps became after replacing 
arrays by linked lists, etc. Of course this is a very old book, focused mostly 
on procedural programming (it has a couple of oop chapter, though).


http://www.urbe.edu/UDWLibrary/InfoBook.do?id=1989

Another great book I've read was "Mastering Delphi" 5 and 6 from Marco Cantú, 
they covered every detail of Delphi, from UI, to Services, and also OOP.


http://www.amazon.com/Mastering-Delphi-6/dp/0782128742

Apart from those, I recommend reading not so Pascal specific books, but 
application design in general, like "Patterns of Enterprise Application 
Architecture" from Martin Fowler.


http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420/ref=sr_1_1?s=books&ie=UTF8&qid=1358855453&sr=1-1&keywords=design+patterns+martin
 
Leonardo M. Ramé
http://leonardorame.blogspot.com

___
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 Leonardo M . Ramé
>
> From: Howard Page-Clark 
>To: FPC users list  
>Sent: Sunday, January 20, 2013 8:37 PM
>Subject: [fpc-pascal] abstract classes
> 
>FPC allows the Delphi-compatible "class abstract" syntax, but does not seem to 
>prevent instantiation of such a class.
>The following code compiles and runs satisfactorily (FPC version 2.6.0)
>Does trunk prevent this compiling?
>
>program Project1;
>
>{$mode objfpc}{$H+}
>
>type
>  TAbstractClass = class abstract
>   class function GetID: integer; static;
>  end;
>
>class function TAbstractClass.GetID: integer;
>begin
>  Result:= 10;
>end;
>
>var
>  ac: TAbstractClass;
>
>begin
>  ac:= TAbstractClass.Create;
>  WriteLn(ac.GetID);
>  ReadLn;
>  ac.Free;
>end.
>

As far as I remember Delphi has the same behavior.


Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Basically on the right track?

2012-12-29 Thread Leonardo M . Ramé
>
> From: Patrick 
>To: FPC-Pascal users discussions  
>Cc: Sven Barth  
>Sent: Saturday, December 29, 2012 1:18 PM
>Subject: Re: [fpc-pascal] Basically on the right track?
> 
>
>I was able to compile helloworld2 and run it without errors.
>
>Sorry for the long email ! thanks for reading it-Patrick
>



Patrick, btw, do you know you can create GTK2 (and QT, Win32, etc) apps with 
FreePascal without bothering with low level GTK2 libraries?, please take a look 
at the Lazarus Project (http://lazarus.freepascal.org), it'll make your life 
much, much easier.

Regards,
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] A simple HTTP request with FPC standard units

2012-11-23 Thread Leonardo M . Ramé


- Original Message -
> From: Michael Van Canneyt 
> To: FPC-Pascal users discussions 
> Cc: 
> Sent: Friday, November 23, 2012 5:07 PM
> Subject: Re: [fpc-pascal] A simple HTTP request with FPC standard units
> 
> 
> 
> On Fri, 23 Nov 2012, Leonardo M. Ramé wrote:
> 
>> 
>> 
>>>  
>>>  From: silvioprog 
>>>  To: FPC-Pascal users discussions 
>  
>>>  Sent: Friday, November 23, 2012 2:38 PM
>>>  Subject: Re: [fpc-pascal] A simple HTTP request with FPC standard units
>>> 
>>> 
>>>  Done:
>>> 
>>> 
>>>  http://bugs.freepascal.org/view.php?id=23372
>>> 
>>> 
>>> 
>>> 
>>>  2012/11/23 silvioprog 
>>> 
>>>  I solved the error. In:
>>>> 
>>>> 
>>>>  fphttpclient.pas:line285
>>>> 
>>>>  Function TFPCustomHTTPClient.GetServerURL(URI : TURI) : String;
>>>> 
>>>> 
>>>>  Var
>>>>    D : String;
>>>> 
>>>> 
>>>>  begin
>>>>    D:=URI.Path;
>>>>    If (D[1]<>'/') then
>>>>      D:='/'+D;
>>>>    If (D[Length(D)]<>'/') then
>>>>      D:=D+'/';
>>>>    Result:=D+URI.Document;
>>>>    if (URI.Params<>'') then
>>>>      Result:=Result+'?'+URI.Params;
>>>>  end;
>>>> 
>>>> 
>> 
>>  The code needed to execute the function could be even smaller if this is 
> changed to a class function. Instead of needing to create an instance, then 
> using, then freeing, the whole thing could something like this:
>> 
>>  ...
>>  begin
>>    s := TFPCustomHTTPClient.GetServerURL('http://a_site/a_page');
>>    writeln(s);
> 
> You mean probably
>    s := TFPCustomHTTPClient.Get('http://a_site/a_page');
> 
> It could be done, but it will need to create an instance anyway. 
> Although I suspect such a simple case is a minority.
> 
> Michael.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Yes, I said this because the original poster wrote he needed the very little 
code to accomplish this.

 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] A simple HTTP request with FPC standard units

2012-11-23 Thread Leonardo M . Ramé


>
> From: silvioprog 
>To: FPC-Pascal users discussions  
>Sent: Friday, November 23, 2012 2:38 PM
>Subject: Re: [fpc-pascal] A simple HTTP request with FPC standard units
> 
>
>Done:
>
>
>http://bugs.freepascal.org/view.php?id=23372
>
>
>
>
>2012/11/23 silvioprog 
>
>I solved the error. In:
>>
>>
>>fphttpclient.pas:line285
>>
>>Function TFPCustomHTTPClient.GetServerURL(URI : TURI) : String;
>>
>>
>>Var
>>  D : String;
>>
>>
>>begin
>>  D:=URI.Path;
>>  If (D[1]<>'/') then
>>    D:='/'+D;
>>  If (D[Length(D)]<>'/') then
>>    D:=D+'/';
>>  Result:=D+URI.Document;
>>  if (URI.Params<>'') then
>>    Result:=Result+'?'+URI.Params;
>>end;
>>
>>

The code needed to execute the function could be even smaller if this is 
changed to a class function. Instead of needing to create an instance, then 
using, then freeing, the whole thing could something like this:

...
begin
  s := TFPCustomHTTPClient.GetServerURL('http://a_site/a_page');
  writeln(s);

end;

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


Re: RE : [fpc-pascal] Currency symbol wrong location

2012-06-09 Thread Leonardo M . Ramé
- Original Message -

> From: Ludo Brands 
> To: 'FPC-Pascal users discussions' 
> Cc: 
> Sent: Saturday, June 9, 2012 12:54 PM
> Subject: RE : [fpc-pascal] Currency symbol wrong location
> 
>>  This is as per doc?
>> 
>>  http://www.freepascal.org/docs-html/rtl/sysutils/format.html
>> 
>>  FloatToStrF(Argument,ffGeneral,Precision,3)
>> 
>>  M    Currency format. the next argument in the var{Args} 
>>  array must be a
>>  floating point value. The argument is converted to a decimal 
>>  string using currency notation. This means that fixed-point 
>>  notation is used, but that the currency symbol is appended. 
>>  If precision is specified, then then it overrides the 
>>  CurrencyDecimals global variable used in the FloatToStrF
>> 
>>      In short, the M specifier formats it's argument as follows:
>> 
>>      FloatToStrF(Argument,ffCurrency,,Precision)
>> 
>>  Note the /append/  :-)
>> 
> 
> Then there seems to be a contradiction in the doc. The position of the
> currency symbol in FloatToStrF with ffCurrency is determined by
> CurrencyFormat. 
> 
>   CurrencyFormat:=0;
>   s:=FloatToStrF(123.25,ffCurrency,5,2);
>   s:=Format('%m', [123.25]);
> 
> Both calls return $123.25 in s.
> 
> Ludo
> 


Thanks, that worked. The trick was CurrencyFormat := 0;
 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Currency symbol wrong location

2012-06-09 Thread Leonardo M . Ramé
- Original Message -

> From: Leonardo M. Ramé 
> To: FPC-Pascal users discussions 
> Cc: 
> Sent: Saturday, June 9, 2012 12:31 PM
> Subject: Re: [fpc-pascal] Currency symbol wrong location
> 
> - Original Message -
> 
>>  From: Michael Van Canneyt 
>>  To: Leonardo M. Ramé ; FPC-Pascal users 
> discussions 
>>  Cc: 
>>  Sent: Saturday, June 9, 2012 11:59 AM
>>  Subject: Re: [fpc-pascal] Currency symbol wrong location
>> 
>> 
>> 
>>  On Sat, 9 Jun 2012, Leonardo M. Ramé wrote:
>> 
>>>   Hi, I want to format a float number to currency. To do this, I use the 
> 
>>  Format function using the %m format, as this:
>>> 
>>>   Format('%m', [123.25]);
>>> 
>>>   I'm using Ubuntu 12.04 and my regional settings at configured to 
>>  display "$ 1234.25", but I'm getting "123.25$", why 
> is 
>>  the money symbol at the right side, instead of using the regional setting?.
>> 
>>  Did you use the CLocale unit ?
>> 
>>  Michael.
>>  ___
>>  fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>>  http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>> 
> 
> No, but after you mentioned I included it in my "uses". The result was 
> a number without the money symbol.
>  


Apart from that, I'm looking a cross-platform solution.
 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Currency symbol wrong location

2012-06-09 Thread Leonardo M . Ramé
- Original Message -

> From: Michael Van Canneyt 
> To: Leonardo M. Ramé ; FPC-Pascal users discussions 
> 
> Cc: 
> Sent: Saturday, June 9, 2012 11:59 AM
> Subject: Re: [fpc-pascal] Currency symbol wrong location
> 
> 
> 
> On Sat, 9 Jun 2012, Leonardo M. Ramé wrote:
> 
>>  Hi, I want to format a float number to currency. To do this, I use the 
> Format function using the %m format, as this:
>> 
>>  Format('%m', [123.25]);
>> 
>>  I'm using Ubuntu 12.04 and my regional settings at configured to 
> display "$ 1234.25", but I'm getting "123.25$", why is 
> the money symbol at the right side, instead of using the regional setting?.
> 
> Did you use the CLocale unit ?
> 
> Michael.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 

No, but after you mentioned I included it in my "uses". The result was a number 
without the money symbol.
 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Currency symbol wrong location

2012-06-09 Thread Leonardo M . Ramé
Hi, I want to format a float number to currency. To do this, I use the Format 
function using the %m format, as this:

Format('%m', [123.25]);

I'm using Ubuntu 12.04 and my regional settings at configured to display "$ 
1234.25", but I'm getting "123.25$", why is the money symbol at the right side, 
instead of using the regional setting?.


Leonardo M. Ramé
http://leonardorame.blogspot.com 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to find a directory?

2012-04-06 Thread Leonardo M . Ramé
To check if a directory exists you can use the function 
"DirectoryExists('/path/to/directory')". To traverse your filesystem, just use 
findfirst-findnext: http://www.freepascal.org/docs-html/rtl/sysutils/findfirst.html

Regards,
Leonardo M. Ramé
http://leonardorame.blogspot.com


>
> From: Timothy Groves 
>To: FPC-Pascal users discussions  
>Sent: Friday, April 6, 2012 6:35 PM
>Subject: [fpc-pascal] How to find a directory?
> 
>So the Powers That Be have decided that FSearch should never find a 
>directory.  Fantastic.  So how *do* I find a directory (for example, to 
>confirm if one exists?)
>___
>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] CGI under Linux using FCL-Web

2012-04-04 Thread Leonardo M . Ramé
Another tip for linux/unix. Try to run the CGI program from the command line, 
it should output something similar to this:

Exception at 00497B3A: Exception:
No REQUEST_METHOD passed from server.

Otherwise there's an error in your code.

Leonardo M. Ramé
http://leonardorame.blogspot.com


>
> From: "michael.vancann...@wisa.be" 
>To: FPC-Pascal users discussions  
>Sent: Wednesday, April 4, 2012 8:42 AM
>Subject: Re: [fpc-pascal] CGI under Linux using FCL-Web
> 
>
>
>On Wed, 4 Apr 2012, Christian Kranich wrote:
>
>> Hello All,
>>
>> I just started to use FPC in  a project requiring a Webinterface.
>> When porting the Lazarus/Win32 fpc-web examples (worked fine)
>> to X86/Linux(Ubuntu) and Arm-Linux, I started to struggle.
>>
>> Under Linux, the cgi program terminates w/o any output and w/o any
>> errormessages. So Apache complains about premature page end.
>>
>> => Is there anything special to consider when using fcl-web under
>> Linux?
>
>Yes.
>
>* Do not use the crt, video or keyboard units.
>* Do not attempt I/O to standard input/output/error.
>
>> => The bread and butter cgi example (mini.pas) did run, but I like the
>> concept of FCL-Web offering scalability between CGI, FastCGI, Apache Module
>> and do not want to reinvent the wheel...
>>
>> Currently I started copying the fcl-web sources to project folder and 
>> pinpointing
>> with writelns to crosscheck what is running and what is not.
>
>Check the error log of apache. 
>It will contain the error output of the CGI script.
>
>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] Burn a CD

2012-03-15 Thread Leonardo M . Ramé
- Original Message -

> From: Marcos Douglas 
> To: Leonardo M. Ramé ; FPC-Pascal users discussions 
> 
> Cc: 
> Sent: Wednesday, March 14, 2012 12:05 PM
> Subject: Re: [fpc-pascal] Burn a CD
> 
> On Wed, Mar 14, 2012 at 7:42 AM, Leonardo M. Ramé  
> wrote:
>>  If you think in the future your app must work in another OSes, maybe a
>>  better solution is to use cdrecord, it has everything you need (CD, DVD,
>>  BluRay) . Here's the Win32
>>  version http://www.student.tugraz.at/thomas.plank/
>> 
>>  We run it using TProcess, then parse the results and show them on screen.
> 
> Interesting. Could you give an example how do you use it, please?
> You do not translated the headers, just use the binaries, rigth?


I don't have a small example, but basically the process is very simple.

First, you need to create an ISO image with mkisofs, part of the CDRtools 
bundle, then use "cdrecord -scanbus" to get a list of drives, and the last step 
is to use cdrecord to burn the ISO image into the drive.

Regarding the 2nd question, I just use the binaries.
 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] class of - instance created is wrong

2012-03-15 Thread Leonardo M . Ramé
>
> From: Graeme Geldenhuys 
>To: FPC-Pascal users discussions  
>Sent: Thursday, March 15, 2012 7:11 AM
>Subject: Re: [fpc-pascal] class of - instance created is wrong
> 
>On 15 March 2012 11:36, Mattias Gaertner  wrote:
>>
>> Is the constructor virtual?
>
>
>It works perfectly now, thanks!!  fpGUI developers can now easily
>switch between X11, GDI and AggPas canvas's. :-D
>


Hi Graeme, this is completely off topic. Does AggPas works in 64bits Linux? I 
remember it didn't compile last year.

Regards,
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Burn a CD

2012-03-14 Thread Leonardo M . Ramé
If you think in the future your app must work in another OSes, maybe a better 
solution is to use cdrecord, it has everything you need (CD, DVD, BluRay) . 
Here's the Win32 version http://www.student.tugraz.at/thomas.plank/

We run it using TProcess, then parse the results and show them on screen.
 
Leonardo M. Ramé
http://leonardorame.blogspot.com


>
> From: stootch 
>To: fpc-pascal@lists.freepascal.org 
>Sent: Wednesday, March 14, 2012 4:26 AM
>Subject: Re: [fpc-pascal] Burn a CD
> 
>W dniu 13.03.2012 14:13, Marcos Douglas pisze:
>> Hi,
>>
>> Anyone knows how burn a CD using the Windows API (should works in XP and
>> Vista)?
>
>Take a look at:
>http://blog.delphi-jedi.net/2009/07/18/im-burning-baby/
>
>Porting to FPC/Lazarus (if any) should be straightforward.
>
>stootch
>___
>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] JSON Dataset in FCL-DB.

2011-12-17 Thread Leonardo M . Ramé
- Original Message -

> From: Leonardo M. Ramé 
> To: FPC-Pascal users discussions 
> Cc: 
> Sent: Saturday, December 17, 2011 10:00 AM
> Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB.
> 
> - Original Message -
> 
>>  From: Michael Van Canneyt 
>>  To: FPC-Pascal users discussions 
>>  Cc: Lazarus mailing list 
>>  Sent: Friday, December 16, 2011 5:52 PM
>>  Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB.
>> 
>> 
>> 
>>  On Fri, 16 Dec 2011, Leonardo M. Ramé wrote:
>> 
>>>>   What is missing currently is the delta to update data on the 
> server, 
>>  but that 
>>>>   should be easily added.
>>>> 
>>>>   Michael.
>>> 
>>> 
>>>   Thanks. 
>>> 
>>>   Btw. I've found this dependency related error when I tried to 
> compile.
>>> 
>> 
>>  Fixed in revision 19858.
>> 
>>  Michael.
> 
> 
> 
> Michael, could you apply this? Without it fpjsondataset unit is not found:
> 
> Index: fpmake.pp
> 
> ===
> --- fpmake.pp   (revision 19860)
> +++ fpmake.pp   (working copy)
> @@ -37,6 +37,7 @@
>      P.SourcePath.Add('src/sqldb/examples');
>      P.SourcePath.Add('src/sqldb/oracle');
>      P.SourcePath.Add('src/sdf');
> +    P.SourcePath.Add('src/json');
>      P.SourcePath.Add('src/datadict');
>      P.SourcePath.Add('src/memds');
>      P.SourcePath.Add('src/codegen');
> @@ -661,6 +662,9 @@
>          end;
>      T.ResourceStrings := True;
> 
> +    // JSON
> +    T:=P.Targets.AddUnit('fpjsondataset.pp');
> +
>      P.ExamplePath.Add('tests');
>      T:=P.Targets.AddExampleProgram('dbftoolsunit.pas');
>      T:=P.Targets.AddExampleProgram('dbtestframework.pas');
> 
>  


Also this on tests directory:

Index: testjsondataset.pp
===
--- testjsondataset.pp  (revision 19860)
+++ testjsondataset.pp  (working copy)
@@ -3,9 +3,8 @@
 {$mode objfpc}{$H+}

 uses
-  Classes, sysutils, DB, jsondataset, fpjson, jsonparser;
+  Classes, sysutils, DB, fpjsondataset, fpjson, jsonparser;

-{$R *.res}

 Function ExtractData(Const AFileName : string) : TJSONObject;

--  
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] JSON Dataset in FCL-DB.

2011-12-17 Thread Leonardo M . Ramé
- Original Message -

> From: Michael Van Canneyt 
> To: FPC-Pascal users discussions 
> Cc: Lazarus mailing list 
> Sent: Friday, December 16, 2011 5:52 PM
> Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB.
> 
> 
> 
> On Fri, 16 Dec 2011, Leonardo M. Ramé wrote:
> 
>>>  What is missing currently is the delta to update data on the server, 
> but that 
>>>  should be easily added.
>>> 
>>>  Michael.
>> 
>> 
>>  Thanks. 
>> 
>>  Btw. I've found this dependency related error when I tried to compile.
>> 
> 
> Fixed in revision 19858.
> 
> Michael.



Michael, could you apply this? Without it fpjsondataset unit is not found:

Index: fpmake.pp

===
--- fpmake.pp   (revision 19860)
+++ fpmake.pp   (working copy)
@@ -37,6 +37,7 @@
     P.SourcePath.Add('src/sqldb/examples');
     P.SourcePath.Add('src/sqldb/oracle');
     P.SourcePath.Add('src/sdf');
+    P.SourcePath.Add('src/json');
     P.SourcePath.Add('src/datadict');
     P.SourcePath.Add('src/memds');
     P.SourcePath.Add('src/codegen');
@@ -661,6 +662,9 @@
         end;
     T.ResourceStrings := True;

+    // JSON
+    T:=P.Targets.AddUnit('fpjsondataset.pp');
+
     P.ExamplePath.Add('tests');
     T:=P.Targets.AddExampleProgram('dbftoolsunit.pas');
     T:=P.Targets.AddExampleProgram('dbtestframework.pas');

 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] JSON Dataset in FCL-DB.

2011-12-16 Thread Leonardo M . Ramé
- Original Message -

> From: Michael Van Canneyt 
> To: FPC-Pascal users discussions 
> Cc: Lazarus mailing list 
> Sent: Friday, December 16, 2011 2:53 PM
> Subject: Re: [fpc-pascal] JSON Dataset in FCL-DB.
> 
> 
> 
> On Fri, 16 Dec 2011, Leonardo M. Ramé wrote:
> 
>>  From: Michael Van Canneyt 
>>>  To: FPC mailing list ; Lazarus 
> mailing list  
>>>  Sent: Friday, December 16, 2011 1:37 PM
>>>  Subject: [fpc-pascal] JSON Dataset in FCL-DB.
>>> 
>>> 
>>>  Hello,
>>> 
>>>  I just committed a JSON dataset in fcl-db.
>>> 
>>>  This is a dataset which stores its data in JSON objects (as in fpjson) 
> in memory. The records are in a JSON array, each record can be a JSON object 
> or 
> array.
>>>  (not mixed)
>>> 
>>>  The dataset is read-write. It can be used to create JSON data from 
> scratch: just add definitions to the fielddefs properties, and call 
> 'Open'. At the end, call SaveToStream().
>>> 
>>>  There are 2 descendents which read/write ExtJS JSON data packages 
> (Objects or Arrays) from streams but they are usable to handle any kind of 
> JSON 
> data. Currently, the dataset does not yet support propagating changes 
> (deltas) 
> back to a server.
>>> 
>>>  I would be glad to recieve feedback, comments.
>>> 
>>>  Michael.
>> 
>> 
>> 
>>  Does this allow executing selects against an sql database and traverse the 
> results using this JSON dataset?
> 
> Yes. I use it as follows:
> 
> Normally, Fcl-web server using the sql-db and fpwebdata sends JSON-Formatted 
> data to a browser.
> 
> I have now a lazarus-written client app which sends a HTTP request to the 
> same 
> webserver, 
> reads the returned JSON, and then opens a dataset with the JSON as source of 
> the 
> data.
> 
> Combined with the Ext.Direct RPC, I intend to use this for N-tier apps where 
> the 
> client 
> can be a native app or a browser.
> 
> What is missing currently is the delta to update data on the server, but that 
> should be easily added.
> 
> Michael.


Thanks. 

Btw. I've found this dependency related error when I tried to compile.

...
PPU Loading /usr/local/lib/fpc/2.7.1/units/x86_64-linux/fcl-web/fpwebdata.ppu
Recompiling fpwebdata, checksum changed for db
Fatal: Can't find unit fpwebdata used by fpjsondataset
...

--  
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] JSON Dataset in FCL-DB.

2011-12-16 Thread Leonardo M . Ramé
From: Michael Van Canneyt 
>To: FPC mailing list ; Lazarus mailing list 
> 
>Sent: Friday, December 16, 2011 1:37 PM
>Subject: [fpc-pascal] JSON Dataset in FCL-DB.
> 
>
>Hello,
>
>I just committed a JSON dataset in fcl-db.
>
>This is a dataset which stores its data in JSON objects (as in fpjson) in 
>memory. The records are in a JSON array, each record can be a JSON object or 
>array.
>(not mixed)
>
>The dataset is read-write. It can be used to create JSON data from scratch: 
>just add definitions to the fielddefs properties, and call 'Open'. At the end, 
>call SaveToStream().
>
>There are 2 descendents which read/write ExtJS JSON data packages (Objects or 
>Arrays) from streams but they are usable to handle any kind of JSON data. 
>Currently, the dataset does not yet support propagating changes (deltas) back 
>to a server.
>
>I would be glad to recieve feedback, comments.
>
>Michael.



Does this allow executing selects against an sql database and traverse the 
results using this JSON dataset?
 
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Markdown parser?

2011-12-05 Thread Leonardo M . Ramé
>
> From: Graeme Geldenhuys 
>To: Leonardo M. Ramé ; FPC-Pascal users discussions 
> 
>Sent: Monday, December 5, 2011 8:41 AM
>Subject: Re: [fpc-pascal] Markdown parser?
> 
>On 3 December 2011 14:46, Leonardo M. Ramé wrote:
>> Hi, does anyone knows if there is a Markdown parser already developed for
>> FreePascal?.
>
>Sorry, I looked everywhere on my work system and our server. I can't
>seem to find my markdown parser anywhere. That'll teach me to use SCM
>systems more often.
>
>I remembered I modeled the code after a very fast Java Markdown
>parser. The code wasn't difficult, so it should go relatively quickly
>to implement a Object Pascal version again.
>
>I did a quick Google search, here is the link to the Java MarkDown
>parser I based my code on.
>
>  https://github.com/rjeschke/txtmark/
>
>You can see from the notes in that URL, it passes all the MarkDown
>tests, and compared to other MarkDown implementation, txtmark
>absolutely flies!
>
>This is what I wanted to implement with MarkDown. An alternative GUI
>fpdoc content editor that uses Markdown syntax.
>  http://www.markdownpad.com/
>
>
>-- 
>Regards,
>  - Graeme -
>
 
Thanks Graeme, I'll take a look at it.

Leonardo M. Ramé
http://leonardorame.blogspot.com

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


[fpc-pascal] Markdown parser?

2011-12-03 Thread Leonardo M . Ramé
Hi, does anyone knows if there is a Markdown parser already developed for 
FreePascal?.
 
Leonardo M. Ramé
http://leonardorame.blogspot.com___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Wireless configuration in Windows

2011-11-29 Thread Leonardo M . Ramé
- Original Message -

> From: ""Jürgen Hestermann"" 
> To: fpc-pascal@lists.freepascal.org
> Cc: 
> Sent: Tuesday, November 29, 2011 11:56 AM
> Subject: [fpc-pascal] Wireless configuration in Windows
> 
> I am trying to access the Wireless interface of the Windows API. It seems 
> that 
> there is no support for these functions in Free Pascal so I defined them 
> myself 
> and accessed them via "Loadlibrary". But WlanOpenHandle always results 
> in error 87 (invalid parameter). I defined:
> 
> ---
> type WlanOpenHandleTyp = function(ClientVersion : DWord;
>                                   Reserved : Pointer;
>                               var NegotiatedVersion : DWord;
>                               var ClientHandle : Hwnd) : DWord;
> ---
> 
> but also tried a different definitions of the first two parameters with CONST.
> 
> I then coded:
> 
> ---
> Var LibHandle       : THandle;
>     H               : Hwnd;
>     WlanOpenHandle  : WlanOpenHandleTyp;
> 
> begin
> LibHandle := Windows.LoadLibrary('wlanapi.dll');
> if LibHandle<>0 then
>    begin
>    WlanOpenHandle := 
> WlanOpenHandleTyp(GetProcAddress(LibHandle,'WlanOpenHandle'));
>    if WlanOpenHandle<>nil then
>       begin
>       j := WlanOpenHandle(1,nil,i,H);
>       if j=Error_Success then 
> ---
> 
> at this point j is 87 (should be 0). Anybody who has an idea why 
> WlanOpenHandle 
> is reporting this error?
> 
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de


Didn't tested, but can you try this?:

Original function:
DWORD WINAPI WlanOpenHandle( __inDWORD dwClientVersion, 
__reserved  PVOID pReserved, __out   PDWORD pdwNegotiatedVersion, 
__out   PHANDLE phClientHandle
);

Pascal conversion:
type WlanOpenHandleTyp = function(ClientVersion : DWord;

                              Reserved : Pointer;
                              out NegotiatedVersion : DWord;
                              out ClientHandle : Cardinal) : DWord;


--  
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fcl-web TFPHttpServer component problem

2011-11-28 Thread Leonardo M . Ramé
>
> From: Graeme Geldenhuys 
>To: FPC-Pascal users discussions  
>Sent: Monday, November 28, 2011 7:42 AM
>Subject: [fpc-pascal] fcl-web TFPHttpServer component problem
> 
>Hi,
>
>I was testing the newish HTTP Server component located in
>fcl-web/src/fphttpserver.pp
>
>I simply created a form with Start/Stop button. The problem is, that
>once I call .Active := True, it never returns from that call, so my
>test program (and thus any program using this server component) is
>stuck in limbo land...
>
>Is this a known problem? And more importantly, is there a work-around?
>I'm using FPC 2.5.1 (the latest revision in the 2.6.0 fixes branch).
>
>
>procedure TMainForm.ButtonClicked(Sender: TObject);
>begin
>  if Button1.Text = 'Start' then
>  begin
>    writeln('before start');
>    FHTTPServer.Active := True;
>    writeln('after start');
>    Button1.Text := 'Stop';
>  end
>  else
>  begin
>    writeln('before stop');
>    FHTTPServer.Active := False;
>    writeln('after stop');
>    Button1.Text := 'Start';
>  end;
>end;
>
>
>Note:
>Once the HTTP Server is running, it does correctly handle and respond
>to HTTP requests, so the worker thread of the http server is working.
>It is just that the program implementing the HTTP Server component is
>frozen, and its process has to be killed to terminate the http server.
>
>
>-- 
>Regards,
>  - Graeme -
>
>


I think that class was meant to be used as the main program loop. Didn't 
tested, but what happens if you use it inside a TThread?.
 

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Leonardo M . Ramé
- Original Message -

> From: "michael.vancann...@wisa.be" 
> To: Leonardo M. Ramé ; FPC-Pascal users discussions 
> 
> Cc: 
> Sent: Wednesday, October 19, 2011 11:03 AM
> Subject: Re: [fpc-pascal] 3-tier database applications with FPC
> 
> 
> 
> On Wed, 19 Oct 2011, Leonardo M. Ramé wrote:
> 
>>>  
>>>  From: Graeme Geldenhuys 
>>>  To: FPC-Pascal users discussions 
> 
>>>  Sent: Wednesday, October 19, 2011 8:25 AM
>>>  Subject: Re: [fpc-pascal] 3-tier database applications with FPC
>>> 
>>>  On 2011-10-19 11:36, michael.vancann...@wisa.be wrote:
>>>> 
>>>>  Out of the box: no.
>>> 
>>>  OK, thanks. Do you know if TClientDataset has improved at all?
>>> 
>>> 
>>>>  Midas is written in C++, so that's not going to happen.
>>> 
>>>  I didn't know that.
>>> 
>>> 
>>>>  OTOH the web-development part has resulted in a ready-to-use packet 
> transport 
>>>>  layer. It's inefficient though, since it uses JSON or XML, but 
> that can
>>>>  easily be adapted to support a 'binary' packet.
>>> 
>>>  I just finished watching a CodeRage 5 Datasnap demo. The guy said that
>>>  XML packet transport is extremely slow (because XML is generally hard 
> to
>>>  parse). Simply changing to CSV packet format gave a 20x speed
>>>  improvement, but obviously CSV is not self-describing.
>>> 
>>>  Is parsing JSON any faster than XML?  Sorry if this is a stupid
>>>  question, but I know near zero about JSON.
>>> 
>> 
>> 
>>  I created a FastCGI based server that handles JSON requests from a
>>  Win32/Linux GUI app, that uses a custom made ORM similar to tiOPF and it
>>  works really fast, even on slow-long distance networks.  I never had to do
>>  this, but as most modern http servers support gzip compression, one
>>  alternative to binary formats is to enable compression on server side, and
>>  decompress on client side.
>> 
>>  This approach has the advantage of JSON readability and the small size of 
> binary format.
> 
> That's exactly what we do also.
> But in the case of large packages (we have datasets of 30.000 records), 
> the JSON is really slow.
> 
> The browser chokes already on a dataset of 3000 records, when using ExtJS =-)
> 
> Michael.
>

In those cases, we use pagination. We allways ask for record 1-100, 101-200, 
and so on.
 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] 3-tier database applications with FPC

2011-10-19 Thread Leonardo M . Ramé
>
>From: Graeme Geldenhuys 
>To: FPC-Pascal users discussions 
>Sent: Wednesday, October 19, 2011 8:25 AM
>Subject: Re: [fpc-pascal] 3-tier database applications with FPC
>
>On 2011-10-19 11:36, michael.vancann...@wisa.be wrote:
>> 
>> Out of the box: no.
>
>OK, thanks. Do you know if TClientDataset has improved at all?
>
>
>> Midas is written in C++, so that's not going to happen.
>
>I didn't know that.
>
>
>> OTOH the web-development part has resulted in a ready-to-use packet 
>> transport 
>> layer. It's inefficient though, since it uses JSON or XML, but that can
>> easily be adapted to support a 'binary' packet.
>
>I just finished watching a CodeRage 5 Datasnap demo. The guy said that
>XML packet transport is extremely slow (because XML is generally hard to
>parse). Simply changing to CSV packet format gave a 20x speed
>improvement, but obviously CSV is not self-describing.
>
>Is parsing JSON any faster than XML?  Sorry if this is a stupid
>question, but I know near zero about JSON.
>


I created a FastCGI based server that handles JSON requests from a Win32/Linux 
GUI app, that uses a custom made ORM similar to tiOPF and it works really fast, 
even on slow-long distance networks. I never had to do this, but as most modern 
http servers support gzip compression, one alternative to binary formats is to 
enable compression on server side, and decompress on client side.

This approach has the advantage of JSON readability and the small size of 
binary format.

Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] List of Integer/Double etc

2011-10-12 Thread Leonardo M . Ramé
>
>From: Sven Barth 
>To: fpc-pascal@lists.freepascal.org
>Sent: Wednesday, October 12, 2011 9:12 AM
>Subject: Re: [fpc-pascal] List of Integer/Double etc
>
>Am 12.10.2011 14:08, schrieb Leonardo M. Ramé:
>> Hi, I'm wondering if the rtl or a standard package includes classes for
>> handling lists of Integer, Double, and other types. Similar to
>> TStringList, but for numerical types.
>
>Using generics this is easy:
>
>=== source begin ===
>
>uses
>  fgl;
>
>type
>  TIntegerList = specialize TFPList;
>  TDoubleList = specialize TFPList;
>
>=== source end ===
>
>Regards,
>Sven
>


Thanks, I'll try that.


Leonardo M. Ramé
http://leonardorame.blogspot.com

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


[fpc-pascal] List of Integer/Double etc

2011-10-12 Thread Leonardo M . Ramé
Hi, I'm wondering if the rtl or a standard package includes classes for 
handling lists of Integer, Double, and other types. Similar to TStringList, but 
for numerical types.

Thanks in advance,
Leonardo M. Ramé
http://leonardorame.blogspot.com___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] TypeInfo Illegal Expression

2011-09-12 Thread Leonardo M . Ramé
I'm converting a Delphi app to FPC and I'm getting an "Error: Illegal 
expression" when I use the function TypeInfo.

Example:

TypeInfo(TDateTime).

The unit that calls this function is mode objfpc.

I'm using FPC 2.7.1 from trunk on Linux x86_64 (Ubuntu 11.04).


Any hint?

Thanks in advance, 
Leonardo M. Ramé
http://leonardorame.blogspot.com___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] 2 bugs ???

2011-09-07 Thread Leonardo M . Ramé
From: Yann Bat 
>To: "fpc-pascal@lists.freepascal.org" 
>Sent: Wednesday, September 7, 2011 11:36 AM
>Subject: [fpc-pascal] 2 bugs ???
>
>Hi,
>
>I am trying to learn freepascal generics and I think that I have found 2 bugs.
>
>Tested with FPC 2.4.4 Linux x86
>
>==
>= BUG 1 - with SizeOf =
>==
>{--- TGen.Bug ---}
>function TGen.Bug : Integer;
>begin
>  Result := 10 div SizeOf(_T);  // *** DIVISION BY ZERO ***
>
>  // THE FOLLOWING CODE IS OK !
>  //
>  // var
>  //   S: Integer;
>  // begin
>  //   S := SizeOf(_T);
>  //   Result := 10 div S;
>end;


The error message is correct, because inside the scope of method  Bug, _T 
points to nil, and the size of nil is 0, so 1 div 0 raises the error.

What about using Result := 100 div SizeOf(FField); ?

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


Re: Re: [fpc-pascal] fpc graph

2011-05-03 Thread Leonardo M . Ramé
Hi John, if you use Lazarus, you can try the component TAChart, it's awesome.
For more info, please check this out: http://wiki.lazarus.freepascal.org/TAChart
P.S.: The wiki currently is not working, but usually it works. So, if you get 
an error message, please try again in a couple of ours.

Leonardo M. Ramé

http://leonardorame.blogspot.com

--- On Mon, 5/2/11, johnelee1...@googlemail.com  
wrote:

From: johnelee1...@googlemail.com 
Subject: Re: Re: [fpc-pascal] fpc graph
To: "FPC-Pascal users discussions" 
Date: Monday, May 2, 2011, 10:03 AM

thanks - what are the features of  ptcgraph vs graph? - I just want simple line 
graphs in win eg of data from a file, so was guessing that graph, from its 
name, was the 'best' option. J  
 

On , Nikolay Nikolov  wrote:
> On 05/02/2011 02:58 PM, John Lee wrote:
> 
> 
> Been trying to use the windows graph from 2.4 release svn, running on 
> standard xp sp3 laptop, with 1024*768 resolution screen setting, 96dpi, intel 
> mobile express 965 chipset according to control panel.
> 
> 
> 
> 
> Note that you can also try unit ptcgraph (and ptccrt) and see if it works 
> better for you.
> 
> ___
> 
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> 
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
>
-Inline Attachment Follows-

___
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] FPImage and GetDataLineStart

2011-04-21 Thread Leonardo M . Ramé
--- On Thu, 4/21/11, michael.vancann...@wisa.be  
wrote:

> From: michael.vancann...@wisa.be 
> Subject: Re: [fpc-pascal] FPImage and GetDataLineStart
> To: "FPC-Pascal users discussions" 
> Date: Thursday, April 21, 2011, 11:09 AM
> 
> 
> On Thu, 21 Apr 2011, Leonardo M. Ramé wrote:
> 
> > --- On Thu, 4/21/11, Marco van de Voort 
> wrote:
> > 
> >> From: Marco van de Voort 
> >> Subject: Re: [fpc-pascal] FPImage and
> GetDataLineStart
> >> To: "FPC-Pascal users discussions" 
> >> Date: Thursday, April 21, 2011, 6:41 AM
> >> In our previous episode, Sven Barth
> >> said:
> >> > Am 20.04.2011 22:20, schrieb Leonardo M.
> Ram?:
> >> > > Hi, I need to write a function that
> replaces
> >> TLazIntfImage by using fpImage, and I can't find
> an
> >> alternative to GetDataLineStart. How can I replace
> it?.
> >> > > Maybe I get your intention wrong, but
> TLazIntfImage is
> >> already using > fpImage and it derives from a
> TFPCustomImage itself.
> >> 
> >> True, but TFPCustomImage is abstact wrt memory
> layout and
> >> doens't provide
> >> row level access, only pixel level access.
> >> 
> >> Only TFPMemoryImage adds the memory access, but
> IIRC only
> >> 64-bit pixels.
> >> (16-bit RGBA)
> >> 
> >> While these abstractions make it easy to make
> fp/fcl-image
> >> somewhat
> >> complete, they are also very memory hungry and
> slow.
> >> 
> >> IIRC I accelerated loading/saving simple 8-bit BMP
> images
> >> 20 to 50 times in
> >> my work code.
> >> 
> > 
> > Do you care to share some insights about what you did
> to accelerate it?
> 
> It is really very easy to accelerate it:
> 
> * Create a TFPCustomImage descendant that is limited to the
> bit depth you need.
> * Do not use palette.
> * Implement GetPixel and SetPixel so they convert from
> 64-bit from/to the depth you used
> * Implement a GetScanLine/SetScanLine specific to your bit
> depth.
> 
> You can now load/save the image very fast using the
> GetScanLine/SetScanLine,
> and all other FPIMage operations will work equally well.
> 
> Following prior discussions on the list, I have a sample
> implementation
> ready (simple RGB, no alpha), but it is not yet committed.
> It's maybe 20 lines of code.
> 
> I'll try and commit it tonight.
> 
> Michael.
> -Inline Attachment Follows-

Thanks Michael and Marco, now I have a *more* clever idea of how to do it.


Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] FPImage and GetDataLineStart

2011-04-21 Thread Leonardo M . Ramé
--- On Thu, 4/21/11, Marco van de Voort  wrote:

> From: Marco van de Voort 
> Subject: Re: [fpc-pascal] FPImage and GetDataLineStart
> To: "FPC-Pascal users discussions" 
> Date: Thursday, April 21, 2011, 6:41 AM
> In our previous episode, Sven Barth
> said:
> > Am 20.04.2011 22:20, schrieb Leonardo M. Ram?:
> > > Hi, I need to write a function that replaces
> TLazIntfImage by using fpImage, and I can't find an
> alternative to GetDataLineStart. How can I replace it?.
> > 
> > Maybe I get your intention wrong, but TLazIntfImage is
> already using 
> > fpImage and it derives from a TFPCustomImage itself.
> 
> True, but TFPCustomImage is abstact wrt memory layout and
> doens't provide
> row level access, only pixel level access.
> 
> Only TFPMemoryImage adds the memory access, but IIRC only
> 64-bit pixels.
> (16-bit RGBA)
> 
> While these abstractions make it easy to make fp/fcl-image
> somewhat
> complete, they are also very memory hungry and slow.
> 
> IIRC I accelerated loading/saving simple 8-bit BMP images
> 20 to 50 times in
> my work code.
> 

Do you care to share some insights about what you did to accelerate it?

Leonardo M. Ramé
http://leonardorame.blogspot.com


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


[fpc-pascal] FPImage and GetDataLineStart

2011-04-20 Thread Leonardo M . Ramé
Hi, I need to write a function that replaces TLazIntfImage by using fpImage, 
and I can't find an alternative to GetDataLineStart. How can I replace it?.


Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Converting .m4a to .wav

2011-03-09 Thread Leonardo M . Ramé
--- On Wed, 3/9/11, Matt Emson  wrote:

> From: Matt Emson 
> Subject: Re: [fpc-pascal] Converting .m4a to .wav
> To: "FPC-Pascal users discussions" 
> Date: Wednesday, March 9, 2011, 1:08 PM
> On 09/03/2011 12:52, Leonardo M.
> Ramé wrote:
> > Hi, does anyone knows if there's a
> library/class/function to handle .m4a (IPhone sound files)?
> also, if it allows conversion to other formats, such as
> .wav?
> 
> m4a is basically aac, so I'd look down that route. However,
> m4a files can be protected by DRM, and those files will be
> much harder, maybe even impossible, to convert. Though, I
> believe the extension becomes m4p when protected, and also
> m4b when an audio book. The format is much richer than MP3
> or WAV as it can contain meta data such as notes, images and
> chapter markers. You'll lose these when converting.
> 
> M

Thanks, I tested a sample file sent by my customer, and it was easy to convert 
with mplayer using this command:

mplayer -ao pcm test.m4a -ao pcm:file="output.wav" 

As mplayer uses ffmpeg library I'm sure I can use it from fpc.

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


[fpc-pascal] Converting .m4a to .wav

2011-03-09 Thread Leonardo M . Ramé
Hi, does anyone knows if there's a library/class/function to handle .m4a 
(IPhone sound files)? also, if it allows conversion to other formats, such as 
.wav?

Thanks in advance,
Leonardo M. Ramé
http://leonardorame.blogspot.com



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


Re: [fpc-pascal] Forward type not resolved

2011-03-03 Thread Leonardo M . Ramé
--- On Thu, 3/3/11, Leonardo M. Ramé  wrote:
> From: Leonardo M. Ramé 
> Subject: [fpc-pascal] Forward type not resolved
> To: "FPC-Pascal users discussions" 
> Date: Thursday, March 3, 2011, 8:06 PM
> Hi, I'm trying to create a forward
> declaration for a class, as I use to do in Delphi, but I'm
> getting "Forward type not resolved". How can I troubleshoot
> this?.
> 
> Here's the code:
> 
> {$mode objfpc}{$H+}
> 
> interface
> 
> uses
>   Classes, SysUtils; 
> 
> type
>   TQuote = class; // forward declaration.
> 
>   TOnSqueeze = procedure (AQuote: TQuote); of object;
> 
>   { TQuote }
> 
>   TQuote = class(TCollectionItem)
>   private
>     FAdjClose: Double;
>     FBBand_Diff: Double;
>   ...
> 
> And, this is the error I'm getting:
> 
> quote.pas(11,12) Error: Forward type not resolved "TQuote"
> 

Sorry, the error was here:

   TOnSqueeze = procedure (AQuote: TQuote); of object;

This line should be:

   TOnSqueeze = procedure (AQuote: TQuote) of object;

Leonardo M. Ramé
http://leonardorame.blogspot.com

> 



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


[fpc-pascal] Forward type not resolved

2011-03-03 Thread Leonardo M . Ramé
Hi, I'm trying to create a forward declaration for a class, as I use to do in 
Delphi, but I'm getting "Forward type not resolved". How can I troubleshoot 
this?.

Here's the code:

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils; 

type
  TQuote = class; // forward declaration.

  TOnSqueeze = procedure (AQuote: TQuote); of object;

  { TQuote }

  TQuote = class(TCollectionItem)
  private
FAdjClose: Double;
FBBand_Diff: Double;
  ...

And, this is the error I'm getting:

quote.pas(11,12) Error: Forward type not resolved "TQuote"


Leonardo M. Ramé
http://leonardorame.blogspot.com



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


[fpc-pascal] About fpGUI and browser plugins

2010-12-20 Thread Leonardo M . Ramé
Hi, does anyone knows if it is possible to create browser plugins and use fpGUI 
on them. Something like Java Applets?.

Leonardo M. Ramé
http://leonardorame.blogspot.com



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


Re: [fpc-pascal] GetTempFileName in Linux

2010-10-05 Thread Leonardo M . Ramé
Well, I need to create BMP files with unique name, to be sent to lpr, then 
printed. 
Instead of using GetTempFileName, I'll use a GUID, with CreateGUID, and 
GUIDToString.

Leonardo M. Ramé

http://leonardorame.blogspot.com

--- On Tue, 10/5/10, ik  wrote:

From: ik 
Subject: Re: [fpc-pascal] GetTempFileName in Linux
To: "FPC-Pascal users discussions" 
Date: Tuesday, October 5, 2010, 2:26 PM

On Tue, Oct 5, 2010 at 17:30, Sven Barth  wrote:


Am 05.10.2010 17:20, schrieb Leonardo M. Ramé:


Hi, if I run this program from command line in Linux, I allways get the same 
result, "/tmp/TMP0.tmp". Shouldn't it return a different file name each 
time it's executed?.



How can I get different file names?



program tempfilename;

uses

   sysutils;

begin

   writeln(GetTempFileName);

end.




Did you delete the file after the run of your program? GetTempFileName always 
starts from 0 and checks whether that file already exists. If not, it returns 
that name else it continues increasing the index.




That's a security risk, because it is very easy to know what will be the file 
name. It should return random name that does not exists on a random length 
(that the developer chooses).

Symlink attack: http://www.infosecwriters.com/texts.php?op=display&id=159 for 
better understanding.


 


Regards,

Sven

___

fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org

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



Ido


-Inline Attachment Follows-

___
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] GetTempFileName in Linux

2010-10-05 Thread Leonardo M . Ramé
Hi, if I run this program from command line in Linux, I allways get the same 
result, "/tmp/TMP0.tmp". Shouldn't it return a different file name each 
time it's executed?. 

How can I get different file names?

program tempfilename;
uses
  sysutils;
begin
  writeln(GetTempFileName);
end.


Leonardo M. Ramé
http://leonardorame.blogspot.com



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


Re: [fpc-pascal] Command line or CGI Printing

2010-09-15 Thread Leonardo M . Ramé
Nice!, and is it possible to send the bitmap data to lpr through a pipe?.

Something like "cat myfile.bmp|lpr". This doesn't work, it just prints garbage, 
maybe "cat" is handling the file as text.

I'm asking this because I don't want to create the file, then print it, then 
delete it, much better if I just create a TMemoryStream and send it to lpr.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Wed, 9/15/10, Graeme Geldenhuys  wrote:

> From: Graeme Geldenhuys 
> Subject: Re: [fpc-pascal] Command line or CGI Printing
> To: "FPC-Pascal users discussions" 
> Date: Wednesday, September 15, 2010, 10:33 AM
> On 15 September 2010 14:20, Leonardo
> M. Ramé  wrote:
> > Hi, I'm looking for a way to send images to a printer
> without using the Printers unit. I can't use it because it
> relies on X (on Linux) and I need to print from a CGI or
> command line application, that must be installed on servers
> without X installed.
> >
> 
> For more details:     man lp
> 
>    Print a double-sided legal document to a
> printer called "foo":
>           lp -d foo -o media=legal
> -o sides=two-sided-long-edge filename
> 
>    Print an image across 4 pages:
>            lp -d bar -o
> scaling=200 filename
> 
>    Print a text file with 12 characters per
> inch, 8 lines per inch, and a
>    1 inch left margin:
>            lp -d bar -o
> cpi=12 -o lpi=8 -o page-left=72 filename
> 
>    Or just print the file to the default
> printer
>            lp "my long
> file.txt"
> 
> 
> 
> -- 
> Regards,
>   - Graeme -
> 
> 
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> ___
> 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] Command line or CGI Printing

2010-09-15 Thread Leonardo M . Ramé
Hi, I'm looking for a way to send images to a printer without using the 
Printers unit. I can't use it because it relies on X (on Linux) and I need to 
print from a CGI or command line application, that must be installed on servers 
without X installed.

Does FPC have a workaround for this?

Leonardo M. Ramé
http://leonardorame.blogspot.com



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


[fpc-pascal] VTK Libraries from FPC

2010-08-21 Thread Leonardo M . Ramé
Hi, does anyone knows if there's an Pascal (FPC or Delphi) wrapper for the VTK 
libraries (http://www.vtk.org) ?.

Regards,
Leonardo M. Ramé
http://leonardorame.blogspot.co



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


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
--- On Mon, 5/24/10, Graeme Geldenhuys  wrote:

> From: Graeme Geldenhuys 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 24, 2010, 4:31 PM
> On 24 May 2010 18:02, Leonardo M.
> Ramé wrote:
> > Aldo, I know it has templates, the problem I'm facing
> now is in Windows Seven 64bits,
> > It can't read environment/GET/POST vars, so the GetVar
> function doesn't return
> > anything. That's why I had to look elsewere.
> 
> 
> Well, you have the code, so why not debug the problem?
> After all, that
> is what developers do. Write and fix software.
> 
Graeme, I'll do...in a couple of weeks. I'm hurried to finish a project that 
must be deployed to Win64, that's why I choosed FreeSpider instead of fpWeb or 
Powtils this time.

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
--- On Mon, 5/24/10, Marcos Douglas  wrote:

> From: Marcos Douglas 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 24, 2010, 3:39 PM
> On Mon, May 24, 2010 at 2:33 PM, Bee
> Jay 
> wrote:
> >
> > Because FCGI app is the true worker app. CGI proxy is
> lightweight app. It does nothing but redirecting incoming
> request and outgoing response, aka proxy. Since it's
> lightweight, the CGI penalty can be ignored.
> >
> >> A FCGI lightweight app would be the proxy for some
> CGI apps. The FCGI
> >> stay in memory, so it is more fast for requests,
> while CGI app would
> >> be more specialized.
> >
> > Take a simple common case, an app that need to connect
> to a database, run an sql query, format the result, send it
> to client, and close the db connection. If it's a CGI app,
> the whole process is done on every single client request.
> 100 incoming request, then 100 times it's done over and
> over.
> >
> > If it's a FCGI app, you could make it connect to
> database once when it goes up, run the sql query once when
> the first request comes, format the result, send it to
> client, then cache the formatted result. If another similar
> request coming in, since the FCGI app stays in the memory,
> it could simply re-send the cached result without re-connect
> and re-query to the database. The cache can be refreshed
> (re-query the database) upon some conditional triggers, i.e.
> time interval, number of similar request, or some special
> kind of request (update query, etc). The db connection only
> need to be closed before the FCGI app is about to terminate
> itself at the end of its session. You can imagine how big
> performance boost you will get. ;)
> 
> I agree about the performance.
> But just one connection to database will be slow and you
> have to
> manager that... or create a thread for each request and
> each thread
> have a connection. Do you agree?
> 
> And about the cache... well, is possible use it even in CGI
> apps (but
> is slower, of course).
> 
> I did not understand why to use CGI and FCGI. Why the FCGI
> apps can
> not receive the requests? Would be faster, don't?
> 
> Marcos Douglas

Yes, but some times your FCGI app must run on one of those cheap shared 
hostings where you can't touch the Apache's httpd.conf file to configure the 
FCGI application. That's why the CGI proxy/gateway approach is used in some 
cases.

If you have full control of the server, the CGI proxy isn't required.

Leonardo M. Ramé
http://leonardorame.blogspot.com






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


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
--- On Mon, 5/24/10, ABorka  wrote:

> From: ABorka 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 24, 2010, 3:24 PM
> On 5/24/2010 09:52, Leonardo M. Ramé
> wrote:
> > -- On Mon, 5/24/10, ABorka 
> wrote:
> >
> >> From: ABorka
> >> Subject: Re: [fpc-pascal] Powtils Apache and
> Windows Seven 64bits
> >> To: "FPC-Pascal users discussions"
> >> Date: Monday, May 24, 2010, 1:48 PM
> >> On 5/24/2010 09:02, Leonardo M. Ramé
> >> wrote:
> >>> Aldo, I know it has templates, the problem I'm
> facing
> >> now is in Windows Seven 64bits, It can't read
> >> environment/GET/POST vars, so the GetVar function
> doesn't
> >> return anything. That's why I had to look
> elsewere.
> >>>
> >>> Leonardo M. Ramé
> >>> http://leonardorame.blogspot.com
> >>
> >> Is this a reported problem? Can you create a bug
> report on
> >> this if it is a reproduceable error?
> >
> > This is the problem with POWTILS.
> >
> > For fpWeb, this is what I posted in Lazarus mailing
> list:
> >
> > I created a basic example called 'cgiproject1'
> consisting of only an TFPWebModule's OnRequest method like
> this, with no action:
> >
> > procedure TFPWebModule1.DataModuleRequest(Sender:
> TObject; ARequest: TRequest;
> > AResponse: TResponse; var Handled: Boolean);
> > begin
> >     AResponse.Content := 'Hello';
> >    Handled := True;
> > end;
> >
> > Without environment vars, the result is this:
> >
> > exception at 00010003B5DC:
> > No REQUEST_METHOD passed from server.
> >
> > If I set the environment var REQUEST_METHOD using "set
> REQUEST_METHOD=POST", or "GET", the result is this:
> >
> > An unhandled exception occurred at $00010001FC05
> :
> > EWriteError : Stream write error
> > $00010001FC05
> > $000100034C77
> > $000100037D54
> > $000100033DCA
> > $000115DE main, line 13 of giproject1.lpr
> >
> > It doesn't matter if I set QUERY_STRING and PATH_INFO,
> the result is the same.
> >
> > Leonardo M. Ramé
> 
> I am not sure what the exception problem might be, but you
> cannot just 
> do a SET command in a command prompt for CGI programs.
> 
> For CGI programs you need to pass global environment
> variables with 
> Apache, it is not automatic. For example, in the Apache
> httpd.conf with 
> a "PassEnv TEMP" or "SetEnv TEMP /pathtotmpdir" line so the
> web server 
> passes this global environment variable to the CGI
> programs' local 
> environment variables. Only these "manually" passed ones
> and the ones 
> Apache sends (the CGI environment variables that are in the
> CGI 
> standard) are visible from within CGI programs.
> 
> AB

I did this command line testing because I was trying to find out what was 
causing the problem, because my trivial example didn't work on Windows Seven 
64, the same test in Linux works fine.

I'll come back to fpWeb in a couple of weeks from now, now I'm hurried to 
finish a small project, and I'll use FreeSpider for it.

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
--- On Mon, 5/24/10, Marcos Douglas  wrote:

> From: Marcos Douglas 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 24, 2010, 3:20 PM
> On Mon, May 24, 2010 at 2:24 PM, Lee
> Jenkins 
> wrote:
> >
> > It is more or less a console application.
> >
> > 1. Request come in.
> > 2. CGI Application starts and handles request through
> stdin/stdout.
> > 3. CGI Application shuts down and release its
> resources.
> >
> > One application is started and then shutdown for every
> request which comes
> > in. Not good for sites that need AJAX, connection
> pooling, persistent
> > objects, etc.  Great (and fast) for sites with basic
> fetch(static, database,
> > etc) and display models, IMO.
> 
> Oh my...
> 
> Then I can do this:
> var
>   s1, s2, s3: TStrings;
> begin
>   s1 := TStringList.Create;
>   s2 := TStringList.Create;
>   s3 := TStringList.Create;
> end;
> 
> ...and at the end, no memory leaks?
> 
> This is true about Desktop (Win/Linux) apps too?
> 
> Marcos Douglas

Marcos, nobody is saying that you don't have to destroy instances when 
programming CGI apps. 

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
-- On Mon, 5/24/10, ABorka  wrote:

> From: ABorka 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 24, 2010, 1:48 PM
> On 5/24/2010 09:02, Leonardo M. Ramé
> wrote:
> > Aldo, I know it has templates, the problem I'm facing
> now is in Windows Seven 64bits, It can't read
> environment/GET/POST vars, so the GetVar function doesn't
> return anything. That's why I had to look elsewere.
> >
> > Leonardo M. Ramé
> > http://leonardorame.blogspot.com
> 
> Is this a reported problem? Can you create a bug report on
> this if it is a reproduceable error?

This is the problem with POWTILS. 

For fpWeb, this is what I posted in Lazarus mailing list:

I created a basic example called 'cgiproject1' consisting of only an 
TFPWebModule's OnRequest method like this, with no action:

procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest;
AResponse: TResponse; var Handled: Boolean);
begin
   AResponse.Content := 'Hello';
  Handled := True;
end;

Without environment vars, the result is this:

exception at 00010003B5DC:
No REQUEST_METHOD passed from server.

If I set the environment var REQUEST_METHOD using "set REQUEST_METHOD=POST", or 
"GET", the result is this:

An unhandled exception occurred at $00010001FC05 :
EWriteError : Stream write error
$00010001FC05
$000100034C77
$000100037D54
$000100033DCA
$00000001000015DE main, line 13 of giproject1.lpr

It doesn't matter if I set QUERY_STRING and PATH_INFO, the result is the same.

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
Aldo, I know it has templates, the problem I'm facing now is in Windows Seven 
64bits, It can't read environment/GET/POST vars, so the GetVar function doesn't 
return anything. That's why I had to look elsewere.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Mon, 5/24/10, Jorge Aldo G. de F. Junior  wrote:

> From: Jorge Aldo G. de F. Junior 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 24, 2010, 12:54 PM
> Powtils is not unmantained, its just
> slow development.
> 
> Powutils has parametrized templates, it just dont have
> documentation
> for the latest version (I developed the template system
> myself).
> 
> 2010/5/24 Felipe Monteiro de Carvalho :
> > On Mon, May 24, 2010 at 5:26 PM, Marcos Douglas 
> wrote:
> >> Don't worry about memory leaks?! But if a do not
> freed an object e.g.
> >> this is continues in memory, even after app ends.
> >
> > No, it doesn't continue in memory.
> >
> > --
> > Felipe Monteiro de Carvalho
> > ___
> > fpc-pascal maillist  -  fpc-pas...@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 maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
--- On Mon, 5/24/10, Marcos Douglas  wrote:

> From: Marcos Douglas 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 24, 2010, 12:04 PM
> On Mon, May 24, 2010 at 11:51 AM,
> Leonardo M. Ramé 
> wrote:
> > Thanks Leledumbo, FreeSpider worked perfectly, I did
> some tests of GET/POST vars and Templates, and it fits my
> needs wonderfully.
> >
> > I also tried fpWeb, but it has some problems
> (EWriteError : Stream write error) on Windows Seven 64, or
> with Apache 2.2.15, I don't know, in Lazarus list I posted a
> couple of questions trying to let it work.
> >
> > The only thing I miss from PowTils is executable size,
> a simple program in FreeSpider took ~7mb, and with -XX -Xs
> it went down to 1.6Mb. I know it will be cached in the
> server, and that's not an issue for my app, but it looks
> like too big for a simple CGI program. Anyway, I'll use it
> for this project.
> 
> Do someone uses FreeSpider? I don't know if it is a real
> framework for
> production.
> 
> 
> Marcos Douglas

I'll use it in production. With CGI you have one advantage over Apache Modules 
or Embedded web servers, as far as your "actions" do their work without errors, 
you don't have to worry about possible memory leaks related to concurrency 
problems or threads or anything like that, CGI's are much less complex than 
servers. Knowing this, I'm pretty sure FreeSpider will fit my needs for this 
particular project.

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-24 Thread Leonardo M . Ramé
Thanks Leledumbo, FreeSpider worked perfectly, I did some tests of GET/POST 
vars and Templates, and it fits my needs wonderfully.

I also tried fpWeb, but it has some problems (EWriteError : Stream write error) 
on Windows Seven 64, or with Apache 2.2.15, I don't know, in Lazarus list I 
posted a couple of questions trying to let it work.

The only thing I miss from PowTils is executable size, a simple program in 
FreeSpider took ~7mb, and with -XX -Xs it went down to 1.6Mb. I know it will be 
cached in the server, and that's not an issue for my app, but it looks like too 
big for a simple CGI program. Anyway, I'll use it for this project.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Mon, 5/24/10, leledumbo  wrote:

> From: leledumbo 
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: fpc-pascal@lists.freepascal.org
> Date: Monday, May 24, 2010, 1:59 AM
> 
> Powtils seems to be ignored by the author for a couple of
> years, use fpWeb or
> FreeSpider instead. Both are maintained and quite advanced
> (fpWeb:
> parameterized templates, FreeSpider: smart module loading),
> and what you
> need: both have working file upload example.
> 
> -- 
> View this message in context: 
> http://old.nabble.com/CGI-file-upload-tp28650163p28653703.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/mailman/listinfo/fpc-pascal
> 



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


[fpc-pascal] Powtils Apache and Windows Seven 64bits

2010-05-23 Thread Leonardo M . Ramé
Hi, after struggling half a day with fpWeb on Windows Seven 64bits and Apache 
2.2.15, I decided to try with Powtils, but it seems to both have problems on 
this platform.

My Powtils CGI program apparently runs fine, but when I try to access Get, Post 
or Env vars they are empty.

This simple example should show the environment var RequestUri, but it gives an 
empty string:

program test;

uses
  pwenvvar,
  pwinit,
  pwmain;

begin
  out('GetCgiRequestUri: ' + GetCgiRequestUri);
end.
   
For example, if I do http://localhost/cgi-bin/test.exe?foo=var, it should show:

"GetCgiRequestUri: /cgi-bin/test.exe?foo=var", but it shows "GetCgiRequestUri:" 
only.

BTW, in Linux it just run fine, 32 and 64bits without any problem.

Does anyone is can run FPC based CGI programs in this environment?

Leonardo M. Ramé

http://leonardorame.blogspot.com




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

Re: [fpc-pascal] OOP and XML usage

2010-01-27 Thread Leonardo M . Ramé
I use a similar approach in a systems integration product for a hospital, it 
communicates different systems by XML files. The app receives an XML with data 
related to an radiology study, then parses the file and convert it to an 
object, do some checkings and transformations, and store the object to a 
database or reject the message.

Most tags are parsed automatically because them have a one-to-one relation to 
the object's properties, and with others we had to create custom associations. 

How it works: 
1) Create an instance of FCL-XML's TXMLFile class, let's call it lXMLDoc, and 
use ReadXMLFile to parse the file.

2) Create a method called, for example ProcessChildNode, as follows: 

procedure TMyClass.ProcessChildNode(ANode: TDomNode);
begin
  while Assigned(ANode) do
  begin
case ANode.NodeType of
  ELEMENT_NODE: begin
if ANode.ParentNode.ParentNode <> nil then
  NodeEvent(ANode);
  end;
  ATTRIBUTE_NODE:;
  TEXT_NODE, CDATA_SECTION_NODE: begin
if ANode.ParentNode.ParentNode <> nil then
   NodeEvent(ANode);
  end;
end;

if ANode.HasChildNodes then
  ProcessChildNode(ANode.FirstChild);
ANode := ANode.NextSibling;
  end;
end;

3) Create the NodeEvent method:

procedure TMyClass.NodeEvent(ANode: TDomNode);
begin
  case ANode.NodeType of
TEXT_NODE,
CDATA_SECTION_NODE: 
   { using RTTI set properties of FMyObject }
   SetPropValue(FMyObject, ANode.NodeName, ANode.NodeValue);
// ... 
// more types
  end;
end;

4) After loading the XML file, let's call ProcessChildNode(lXMLDoc.FirstChild) 
this is a recursive method which will traverse all the XML tree, and it will 
call the NodeEvent method on only certain types of nodes (look at 
ProcessChildNode method). In NodeEvent, the value of the node is set to the 
PUBLISHED object's properties by using RTTI, of course, if your XML file 
doesn't match one-to-one with your object, you can avoid using RTTI and do the 
assignments by hand.

A side note, if your target object, apart from having plain types, it includes 
properties of type Object, you can adapt the NodeEvent method, and check for 
ANode.ParentNode.NodeName = 'MyInnerObject', then set 
FMyObject.MyInnerObject.SomeProperty. That's the way we use to populate an 
object from an XML file.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Wed, 1/27/10, Graeme Geldenhuys  wrote:

> From: Graeme Geldenhuys 
> Subject: [fpc-pascal] OOP and XML usage
> To: "FPC-Pascal users discussions" 
> Date: Wednesday, January 27, 2010, 6:47 AM
> Hi,
> 
> The small project I am working on requires reading a XML
> file and using
> that data for various things, including building a GUI
> interface.
> 
> Most of my projects are database driven and uses the tiOPF
> framework to do
> my load/saving work (plus a lot of other things).
> 
> As the title says, all my applications are normally object
> driven. This new
> project I am working on should not be any different. One
> big difference
> though is that it is not database driven and I don't want
> to bind it to
> tiOPF framework.
> 
> So at the moment I reading the xml file and building my own
> object model
> based on the various elements and attributes in the XML
> file.
> 
> Example:
> 
> -
> 
> 
>   text for install element
>   
>   x
> 
> 
> 
> ...would translate to classes as follows: elements become
> classes and
> attributes become properties...
> 
>  TSetupFile
>  TInstall
>  TEULAList
>    TEULA
> 
> Interfaces section of TInstall might look like this
> 
>   TInstall = class(TObject)
>   public
>     property Text: string...     
> // 'text for install element'
>     property Desc: string...     
> // 'my description'
>     property Version: string     
> // '0.9'
>     property EulaList: TEULAList .
>   end;
> 
> 
> This makes sense to me, and this is the design I am used to
> following with
> tiOPF based projects. But like I said, I am not using tiOPF
> this time and I
> am working with a XML file, which I haven't worked with
> before.
> 
> 
> Am I taking the right OOP approach here, or should I rather
> be working with
> the dom unit and TXMLDocument, TXMLElement etc classes
> directly. At the
> moment I do not require writing to the XML file, only
> reading. At a much
> later date, I'll be writing to the XML file though.
> 
> I feel my approach of using my own specialized classes is a
> better fit
> compared to the generic TXMLElement classes. But I just
> want to confirm my
> thoughts and also ask...
> 
>    How do other developers use XML files?
> 
> 
> Re

Re: [fpc-pascal] GetPropValue and Unknown property

2009-06-23 Thread Leonardo M . Ramé

Yes, Mattias is right, I copied-pasted-removed some stuff from one of my 
programs and leaved out the FreeMem part.

This is a modified version:

procedure GetClassProperties(AClass: TClass);
(* get published properties into a list *)
var
 PropList:  ppropList;
 ClassTypeInfo: PTypeInfo;
 I: Integer;
 lProps:   Integer;
begin
 (* Get properties and a pointer to class *)
 lProps := GetTypeData(AClass.ClassInfo)^.PropCount;
 if lProps <> 0 then
 begin
(* Properties list to be analyzed *)
   GetPropList(AClass.ClassInfo, PropList);
for I := 0 to lProps -1 do
  writeln(PropList[I]^.name);

   (* Free memory allocated for PropList *)
   FreeMem(PropList);
 end;
end;

 Leonardo M. Ramé
http://leonardorame.blogspot.com



- Original Message 
From: Mattias Gärtner 
To: fpc-pascal@lists.freepascal.org
Sent: Tuesday, June 23, 2009 10:20:10 AM
Subject: Re: [fpc-pascal] GetPropValue and Unknown property

Zitat von "Leonardo M. Ramé" :

> 
> 
> 
> How are you filling the ASortProps array? if it is by hand, you have to take 
> care of Case Sensitivity of property names.
> 
> You can use this function to know the published properties of any class. Try 
> it inside your DoCompareProps, passing TFTPListRec(AItem1).ClassType as 
> param, if AItem1 is an instance it should list all its properties:
> 
> procedure GetClassProperties(AClass: TClass);
> (* get published properties into a list *)
> var
>   PropList:  ppropList;
>   ClassTypeInfo: PTypeInfo;
>   I: Integer;
>   lProps:Integer;
> begin
>   (* Get properties and a pointer to class *)
>   lProps := GetTypeData(AClass.ClassInfo)^.PropCount;
>   if lProps <> 0 then
>   begin
> (* Properties list to be analyzed *)
> for I := 0 to GetPropList(AClass.ClassInfo, PropList) -1 do
>   writeln(PropList[I]^.name);
>   end;
> end;

This will create a mem leak. Call GetPropList only once and FreeMem the 
PropList at the end.


Mattias

--
Powered by NetMail
___
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] MSEide+MSEgui rev 2.2beta1

2009-06-23 Thread Leonardo M . Ramé

Great!, please don't forget to add this announcement to 
http://www.msegui.org/news

 Leonardo M. Ramé
http://leonardorame.blogspot.com



- Original Message 
From: Martin Schreiber 
To: FPC-Pascal discussions 
Sent: Tuesday, June 23, 2009 8:58:18 AM
Subject: [fpc-pascal] MSEide+MSEgui rev 2.2beta1

Hi,
There is a first beta of MSEide+MSEgui rev. 2.2:
https://sourceforge.net/project/showfiles.php?group_id=165409

Questions and bugreports please to NNTP:
news://news.grid-sky.com/public.mseide-msegui.talk

Martin
___
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] GetPropValue and Unknown property

2009-06-23 Thread Leonardo M . Ramé



How are you filling the ASortProps array? if it is by hand, you have to take 
care of Case Sensitivity of property names.

You can use this function to know the published properties of any class. Try it 
inside your DoCompareProps, passing TFTPListRec(AItem1).ClassType as param, if 
AItem1 is an instance it should list all its properties:

procedure GetClassProperties(AClass: TClass);
(* get published properties into a list *)
var
  PropList:  ppropList;
  ClassTypeInfo: PTypeInfo;
  I: Integer;
  lProps:Integer;
begin
  (* Get properties and a pointer to class *)
  lProps := GetTypeData(AClass.ClassInfo)^.PropCount;
  if lProps <> 0 then
  begin
(* Properties list to be analyzed *)
for I := 0 to GetPropList(AClass.ClassInfo, PropList) -1 do
  writeln(PropList[I]^.name);
  end;
end;

 

Leonardo M. Ramé
http://leonardorame.blogspot.com



- Original Message 
From: Antonio Sanguigni 
To: FPC-Pascal users discussions 
Sent: Tuesday, June 23, 2009 7:41:56 AM
Subject: [fpc-pascal] GetPropValue and Unknown property

Hi all,

I'm trying to derive a new class TSortFtpSend from synapse TFtpSend
class, which implements a quicksort algo based on published property
passed to this method.
I'm having some troubles with this code because GetPropValue seems
does not find the published property I need:

function TSortFtpSend.DoCompareByProps(AItem1: Pointer; AItem2: Pointer;
  const ASortProps: array of string; AAscendingOrder: Boolean): integer;
var
  i : integer;
  lsPropName : string;
  lValue1 : variant;
  lValue2 : variant;
begin
  result := 0;
//  try
for i := Low(ASortProps) to High(ASortProps) do
begin
  lsPropName := ASortProps[i];
  writeln(TFTPListRec(AItem1).FileName);
  writeln(TFTPListRec(AItem1).FileSize);
  lValue1 := GetPropValue(TFTPListRec(AItem1),lsPropName); // <==
Here I got the Unknown property FileSize exception
  lValue2 := GetPropValue(TFTPListRec(AItem2),lsPropName);

[CUT]

It seems GetPropValue cannot find published property FileSize but the
writeln statement works well printing the exact value, and of course
the properties are published. Someone has an idea why that is not
working here ?

Thanks
Antonio



-- 
Antonio Sanguigni alias slapshot
--
GioveLUG (Linux User Group) - http://www.giovelug.org
Edupup (Educational distro) - http://www.pieroni.biz/edupup
___
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] TPicture (Graphics unit)

2009-06-07 Thread Leonardo M . Ramé

Thanks Graeme, I'll take a look at fpimage unit.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Sun, 6/7/09, Graeme Geldenhuys  wrote:

> From: Graeme Geldenhuys 
> Subject: Re: [fpc-pascal] TPicture (Graphics unit)
> To: "FPC-Pascal users discussions" 
> Date: Sunday, June 7, 2009, 4:22 AM
> Leonardo M. Ramé wrote:
> 
> > in Graphics.pas, but I can't find it in FPC. Is this
> class replaced
> > by a similar one?
> 
> I you just want to load and manipulate an image, you should
> be able to use the fpimage.pp unit included with FPC. I you
> are looking for the TPicture class specifically, then you
> will have to use the Lazarus LCL (Lazarus Component Library)
> which is a clone of the Delphi VCL.
> 
> 
> Regards,
> - Graeme -
> 
> -- 
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> 
> ___
> 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] TPicture (Graphics unit)

2009-06-06 Thread Leonardo M . Ramé

Hi, I'm porting a Delphi application from Windows to FreeBSD, and one of my 
unit uses the TPicture class. In Delphi this class can be found in 
Graphics.pas, but I can't find it in FPC. Is this class replaced by a similar 
one?

I'm using FPC 2.2.4.
 Leonardo M. Ramé
http://leonardorame.blogspot.com



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


Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé

This sounds good, just also check what happens if FindClose receives an invalid 
handle.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Mon, 5/18/09, Michael Van Canneyt  wrote:

> From: Michael Van Canneyt 
> Subject: Re: [fpc-pascal] FindFirst...FindClose
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 18, 2009, 4:03 PM
> 
> 
> On Mon, 18 May 2009, Marco van de Voort wrote:
> 
> > In our previous episode, Jonas Maebe said:
> >>>>
> >>>> Yes.
> >>>
> >>> Huh ? Since when is this requirement ?
> >>
> >> Since as long as I can remember. It at least
> predates the switch to
> >> svn (revision 1 of both rtl/unix/dos.pp and of
> rtl/unix/sysutils.pp
> >> requires it).
> >
> > The current situation is probably simply the old
> "linux" unit routines
> > folded into sysutils. The fact that it is documented
> that way probably makes
> > it more than likely it was no mistake.
> 
> Given that I documented it, I'd rather say that I was
> sloppy in the
> formulation. I've always assumed that the findclose was
> only needed
> in case of a _succesful_ findfirst, i.e. one that returns
> 0.
> And I've seen a lot of code that assumes the same
> (admittedly, it was
> Win32 code).
> 
> Once more, if this is so, there is a lot of code that needs
> to be
> checked in FPC. It might be easier to "fix" findfirst so
> that in case
> of an error (nonzero return value), the searchrec record is
> cleared,
> and the findclose() call is redundant.
> 
> I checked the windows code, and FindClose explicitly checks
> that
> the searchrec record contains a valid handle (i.e. NOT
> INVALID_HANDLE_VALUE), so all platforms would behave the
> same.
> 
> Opinions ? If no-one objects, I'll implement the 'fix',
> it's only
> 2 lines of code.
> 
> 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] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé

You are not alone Michael, I also have to rewrite all of my 
FindFirst...FindClose calls :).

By reading the documentation a little more, I found that the unit OldLinux 
includes the Glob() function to search for files in Linux. This function 
returns a pointer that must be explicitly disposed by the GlobFree function, it 
doesn't matter if files where found or not.

I can't confirm this, but maybe FindFirst in linux is a wrapper to Glob, and 
that's why FindClose (in Linux) must be called outside the if.


Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Mon, 5/18/09, Michael Van Canneyt  wrote:

> From: Michael Van Canneyt 
> Subject: Re: [fpc-pascal] FindFirst...FindClose
> To: "FPC-Pascal users discussions" 
> Date: Monday, May 18, 2009, 12:25 PM
> 
> 
> On Mon, 18 May 2009, Jonas Maebe wrote:
> 
> > 
> > On 18 May 2009, at 16:39, Leonardo M. Ramé wrote:
> > 
> > >Apparently my program gets stuck after a couple
> (several, in fact) of calls
> > >to the function that includes this code.
> > >
> > >By reading the FPC.RTL documentation, I found it
> says that FindClose must be
> > >used outside the if, as follows:
> > >
> > >if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then
> > >begin
> > > repeat
> > >   ...
> > >   ...
> > >until FindNext(sr) <> 0;
> > >end;
> > >FindClose(sr);
> > >
> > >Can be this the cause of the problem in my
> application?.
> > 
> > Yes.
> 
> Huh ? Since when is this requirement ? 
> 
> If it is correct, 100% of my FindFirst/FindClose code must
> be rewritten !
> 
> Michael.
> -Inline Attachment Follows-
> 
> ___
> 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] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé

Hi, I ported a Delphi service to linux using FPC. The app uses FindFirst, 
FindNext and FindClose the same way Delphi Help shows:

if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then
begin
  repeat
...
...
  until FindNext(sr) <> 0;
  FindClose(sr);
end;

Apparently my program gets stuck after a couple (several, in fact) of calls to 
the function that includes this code.

By reading the FPC.RTL documentation, I found it says that FindClose must be 
used outside the if, as follows:

if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then
begin
  repeat
...
...
  until FindNext(sr) <> 0;
end;
FindClose(sr);

Can be this the cause of the problem in my application?.

Thanks in advance.

Leonardo M. Ramé
http://leonardorame.blogspot.com



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


Re: [fpc-pascal] Re: XML pretty formatter

2009-05-15 Thread Leonardo M . Ramé

People, my problem was solved with the help of xsltproc in a Linux box where 
one our services is running, and it works really good. 

But it could be nice to have an Object Pascal version of the library, to be 
able to do the same without needing to use an external program.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Fri, 5/15/09, Graeme Geldenhuys  wrote:

> From: Graeme Geldenhuys 
> Subject: Re: [fpc-pascal] Re: XML pretty formatter
> To: "FPC-Pascal users discussions" 
> Date: Friday, May 15, 2009, 6:09 AM
> On Fri, May 15, 2009 at 11:01 AM,
> Michael Van Canneyt >
> > IMHO we should have the latter. We have a
> near-complete DOM implementation
> > in native object pascal, we have XPath in native
> pascal. It seems only natural
> > to have XSLT native as well...
> 
> That would be nice obviously, but it's not something I
> think can be
> done quickly. A project for a rainy day (oh boy, I'm
> screwed - it's
> winter here).  :-)
> 
> I'll make a note in my todo list, but realistically I will
> not be able
> to touch it for the next 12 months. My clones are on
> strike!
> 
> Regards,
>   - Graeme -
> 
> 
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> ___
> 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] XML Pretty Formatter

2009-05-14 Thread Leonardo M . Ramé

Thanks Graeme!, pretty_print.xsl solved the issue. 

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Thu, 5/14/09, Graeme Geldenhuys  wrote:

> From: Graeme Geldenhuys 
> Subject: Re: [fpc-pascal] XML Pretty Formatter
> To: "FPC-Pascal users discussions" 
> Date: Thursday, May 14, 2009, 12:05 PM
> On Thu, May 14, 2009 at 1:57 PM,
> Leonardo M. Ramé 
> wrote:
> >
> > Hi, I'm looking for a simple XML pretty formatter, or
> parser who can remove
> > all superfluous characters from XML files.
> 
> I have created just the thing for you. :-)
> I created to XSL files that cleans up XML files. I used it
> for the
> FPDoc xml which when created by makeskel is really ugly.
> ;-)
> 
> usage is as follows:
> 
>    $ xsltproc -o new.xml pretty_print.xsl
> ugly.xml
> 
> Hope that's useful.
> 
> 
> Regards,
>   - Graeme -
> 
> 
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> 
> -Inline Attachment Follows-
> 
> ___
> 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: XML pretty formatter

2009-05-14 Thread Leonardo M . Ramé

Thanks Seth and Graeme, the problem is the program must run on a remote server 
that hasn't installed Tidy.pm, but fortunately it has xsltproc, so I'll try 
Graeme's solution.

BTW, is there any Pascal source code out there to do this?.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Thu, 5/14/09, Seth Grover  wrote:

> From: Seth Grover 
> Subject: [fpc-pascal] Re: XML pretty formatter
> To: fpc-pascal@lists.freepascal.org
> Date: Thursday, May 14, 2009, 2:06 PM
> I don't know what your requirements
> are for platform/language, but
> this works nicely for me:
> 
> --
> #!/usr/bin/perl
> 
> use XML::Tidy;
> 
> my $xmlFile = '/path/to/filename';
> my $tidy_obj = XML::Tidy->new('filename' =>
> $xmlFile);
> $tidy_obj->tidy();
> $tidy_obj->write();
> --
> 
> >
> > Hi, I'm looking for a simple XML pretty formatter, or
> parser who can remove all superfluous characters from XML
> files.
> >
> > My application receives an XML file from an external
> app. containing many spaces and CRLFs after closing tags,
> this doesn't affect my parser, but I need to add the XML to
> a log file and those spaces make very difficult to read the
> logs.
> >
> > Thanks in advance.
> >
> > Leonardo M. Ramé
> 
> 
> --
> This email is fiction. Any resemblance to actual events
> or persons living or dead is purely coincidental.
> 
> Seth Grover
> sethdgrover[at]gmail[dot]com
> ___
> 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] XML Pretty Formatter

2009-05-14 Thread Leonardo M . Ramé

Hi, I'm looking for a simple XML pretty formatter, or parser who can remove all 
superfluous characters from XML files.

My application receives an XML file from an external app. containing many 
spaces and CRLFs after closing tags, this doesn't affect my parser, but I need 
to add the XML to a log file and those spaces make very difficult to read the 
logs.

Thanks in advance.

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


Re: [fpc-pascal] A question or two regarding the FPC

2009-05-08 Thread Leonardo M . Ramé

Wow!, is good to know I'm not the only Argentinian using FPC.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Fri, 5/8/09, Gustavo Enrique Jimenez  wrote:

> From: Gustavo Enrique Jimenez 
> Subject: Re: [fpc-pascal] A question or two regarding the FPC
> To: "FPC-Pascal users discussions" 
> Date: Friday, May 8, 2009, 2:35 PM
> Hi Nino:
> 
>  I am using FPC since 2000-2001. I use it for data
> aquisition and
> temperature control. Console programs compiled with FPC 1.x
> work for
> days, even weeks. In the "Laboratorio de Física del
> Sólido, Tucumán -
> Argentina" (Solid state physics laboratory) we have used
> programs
> compiled with FPC to grow YBACuO superconductor crystals.
> This process
> take weeks.
>  This heat treatment is the only "mission critical
> application" that I
> know well, and FPC works reliably, even for weeks, on linux
> machines.
> 
> Gustavo
> 
> ps:excuse my english
> 
> 
> 2009/5/8  :
> > Hi guys,
> >
> > Over the last few years, I have written hundreds of
> thousands of lines of
> > object pascal code that compiles successfully using
> the FPC and Delphi. To
> > date, I have not encountered any problems with the
> code generated by the
> > FP Linux compiler. I don't have much experience with
> FPC within the MS Windows
> > environment as my current interest lies in developing
> console Linux apps.
> >
> > Like most developers, I strive to write code that is
> as bug free as possible
> > and at the end of each day, I'm left with a feeling of
> great satisfaction and
> > achievment.
> >
> > IMO and experience, the code generated by the FPC is
> as resilient as the
> > operating system it runs on.
> >
> > My question is directed to the FPC team and in
> particular, to those involved
> > in the development of the compiler and more specific,
> the Linux compiler. (I
> > would expect that Florian would have a say here).
> >
> > In your opinion, how would you rate the suitability of
> the FPC generated code
> > for use in an environment where there is near zero
> tolorance to failure?
> > Consider the question assuming that the ideal
> condition where that the source
> > code is as close to being perfect as possible, (and
> I'm not suggesting that
> > this perfect code would be written by me. I'm not that
> good).
> >
> > Where am I going with this question you might ask?
> Well, what is the
> > difference with say, the code generated by an ADA95
> compiler and that
> > generated by the FPC. Perhaps someone out there might
> know. What determines
> > the robustness of the generated code? Could the FPC be
> rated by some
> > authority as being able to generate code of some world
> defined standard?
> >
> > I know that if I were to manufacture a device or
> appliance that was controlled
> > by FPC code and the device, say a home alarm system,
> functioned as designed
> > and as specified, then the fact that the device is
> controlled by code
> > generated by the FPC would be irrelevant. However, if
> the device were designed
> > to control the laser beam that reshapes a human cornea
> (eye), then the
> > compiler and operating system is of relevance. (The
> possibility of someone
> > using MS Windows CE and Micro .NET comes to mind).
> >
> > In conclusion, perhaps somebody has already had
> similar thoughs with regards
> > to the above question(s) and has some answers. Would
> be cool to have the FPC
> > team's sincere thoughs on the above.
> >
> > Keep up the good work guys and thanks for a superb
> compiler (and RTL - of
> > course).
> >
> > Regards,
> > Nino
> >
> > ___
> > fpc-pascal maillist  -  fpc-pas...@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 maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] httpdefs.pp multipart/form-data

2009-04-12 Thread Leonardo M . Ramé

Hi, I'm looking at httpdefs.pp file from FCL-Web and found that it handles 
multipart/form-data. I've been using a 3rd party parser for this kind of data, 
but it lacks of a good method of parsing large file uploads.

My question is: ProcessMultipart method, handles the parsing in chunks of data, 
instead of loading the whole data into memory?.

Thanks in advance,
Leonardo.



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


Re: [fpc-pascal] Re: Servlet server for Fpc apps

2009-03-30 Thread Leonardo M . Ramé

Andrew, do you have an example, or web page where we can read more about the 
project?


Leonardo M. Ramé


--- On Mon, 3/30/09, Andrew Brunner  wrote:

> From: Andrew Brunner 
> Subject: Re: [fpc-pascal] Re: Servlet server for Fpc apps
> To: "FPC-Pascal users discussions" 
> Date: Monday, March 30, 2009, 2:51 PM
> I've been reading this thread for a
> while and wanted to ask something...
> 
> What if someone had a cluster based cloud computing server
> written
> entirely from the ground up in Delphi?  Including
> hot-swappable core
> object for backend AJAX calls and all the major Web2.0
> protocol
> implements (XMPP/HTTP/SMTP/POP3)...
> 
> Would there be anyone or a group of people reading this who
> would be
> willing to help port it from Delphi into a FPC/Lazarus
> xPlatform
> build?
> 
> Would there be anyone or a group of people reading this who
> know where
> one could procure funding for an open source Social Media
> Server?
> 
> If you are interested in contributing code or can help in
> any way
> please let me hear from you...
> 
> Thanks.
> ___
> 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] Servlet server for Fpc apps

2009-03-27 Thread Leonardo M . Ramé

Eduardo, I made an example (a couple of years ago) of what you're trying to do:

http://leonardorame.blogspot.com/2007_04_01_archive.html

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Fri, 3/27/09, Eduardo Morras  wrote:

> From: Eduardo Morras 
> Subject: Re: [fpc-pascal] Servlet server for Fpc apps
> To: "FPC-Pascal users discussions" 
> Date: Friday, March 27, 2009, 7:37 PM
> At 22:00 27/03/2009, you wrote:
> 
> > Eduardo, the short answer is no, it wouldn't work.
> Tomcat doesn't understand binary files, it only "executes"
> Java classes. Your options are: 1) CGI. 2) Apache Modules.
> 3) Your own web server.
> 
> I will opt for the 3rd. then. All in pascal of course and
> free...
> 
> > Leonardo M. Ramé http://leonardorame.blogspot.com ---
> 
> Thanks again Leonardo
> 
> 
> 
> ___
> 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] Servlet server for Fpc apps

2009-03-27 Thread Leonardo M . Ramé

Eduardo, the short answer is no, it wouldn't work. Tomcat doesn't understand 
binary files, it only "executes" Java classes.

Your options are:

1) CGI.
2) Apache Modules.
3) Your own web server.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Fri, 3/27/09, Eduardo Morras  wrote:

> From: Eduardo Morras 
> Subject: [fpc-pascal] Servlet server for Fpc apps
> To: fpc-pascal@lists.freepascal.org
> Date: Friday, March 27, 2009, 5:38 PM
> Hello:
> 
> I want to ask (and know) if i can use apache-tomcat to
> serve servlets developed with freepascal. If not, is there a
> similar server for fpc? Note that i want/need servlet like
> in java and other languages, not a propetary format or cgi
> or anyother.
> 
> P.S. Yes, i have googled but for servlet freepascal i found
> references to THttpServlet and i already use it/them, or
> references to java servlets.
> 
> TIA
> 
> -
> One reason that life is complex is that it has a real part
> and an imaginary part
>    -Andrew Koenig  
> ___
> 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] TStream ReadComponent

2009-03-20 Thread Leonardo M . Ramé

Hi, I'm trying to read a file stream created using TMemoryStream's 
WriteComponent method with a Delphi 7 program. To read the component I use 
TMemoryStream's ReadComponent method.

When I read use ReadCompoent, a EReadError is raised. Does anyone tried this?. 
The same program works perfectly in Delphi.

Leonardo.



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


Re: [fpc-pascal] fpc 2.2.2 in fink for Mac OS X

2008-12-19 Thread Leonardo M . Ramé
Hi Karl-Michael, what is Fink? where can I look about it?.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Fri, 12/19/08, Schindler Karl-Michael 
 wrote:

> From: Schindler Karl-Michael 
> Subject: [fpc-pascal] fpc 2.2.2 in fink for Mac OS X
> To: fpc-pascal@lists.freepascal.org
> Date: Friday, December 19, 2008, 6:24 AM
> Hi
> 
> A revised version of fpc 2.2.2 has been added to the
> unstable tree of fink. Main new features are IntelMac
> crosscompilers for Win32 and linux-i386. The i386
> crosscompiler for PowerPC should be added within days.
> 
> I would welcome test reports. As soon as there is
> sufficient positive feedback, I could ask for promoting the
> packages from the unstable tree to the stable tree of fink.
> 
> Merry Christmay and and a happy New Year -
> 
> Karl-Michael Schindler aka mischi
> ___
> 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: Porting linux to pascal, would it be possible ?

2008-12-05 Thread Leonardo M . Ramé
--- On Fri, 12/5/08, Guillermo Martínez Jiménez <[EMAIL PROTECTED]> wrote:

> By the way, Linux is good as it is now and Pascal isn't the best
> option to create an operating system.

Are you sure? doesn't older MacOS's versions where written in Object Pascal?

I think the problem here (again) is not the language, it's the critical mass of 
users of the language. Using C for Linux was a good bet, not because the 
language is good (Pascal is way better for me), but because C has a wider user 
base who can fix/add features.

Leonardo M. Ramé
http://leonardorame.blogspot.com




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


Re: [fpc-pascal] Starting out with Free Pascal

2008-12-01 Thread Leonardo M . Ramé
That's a partial truth, it takes the same time to create basic screens/dialogs 
using FoxPro or data aware components with Lazarus, but the level of 
customization and flexibility you can reach using Lazarus is way ahead of 
FoxPro.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Mon, 12/1/08, Francisco Reyes <[EMAIL PROTECTED]> wrote:

> From: Francisco Reyes <[EMAIL PROTECTED]>
> Subject: Re: [fpc-pascal] Starting out with Free Pascal
> To: "FPC-Pascal users discussions" 
> Date: Monday, December 1, 2008, 2:24 AM
> Bill writes:
> 
> > I'm absolutely new to this list... and to Pascal.
> I was getting pretty good with Foxpro programming when MS
> bought and then changed the 
> 
> Although I have not tried Lazarus, I am not sure  it will
> compare to what you had in Foxpro. My impression is that
> Foxpro was higher level and you could do more with fewer
> lines of code than what you will do with Lazarus+libs.
> 
> Are you writing user facing type of apps or backed database
> work?
> ___
> 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] Preprocessor

2008-11-24 Thread Leonardo M . Ramé
Hi, does exists something like a preprocessor for FPC?, something like 
DLangExtensions (http://andy.jgknet.de/blog/?p=320) from Andreas Hausladen?

It could be really neat to add such a feature.

Leonardo.



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


Re: [fpc-pascal] CGI upload app

2008-11-04 Thread Leonardo M . Ramé
If you checkout Powtils from svn at http://powtils.googlecode.com/svn/dev 
you'll find an example inside examples/upload-file.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Tue, 11/4/08, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote:

> From: Graeme Geldenhuys <[EMAIL PROTECTED]>
> Subject: Re: [fpc-pascal] CGI upload app
> To: "FPC-Pascal users discussions" 
> Date: Tuesday, November 4, 2008, 5:45 AM
> Hi Darius,
> 
> Did you ever manage to get an example of uploading a file? 
> I've got a
> CGI app based on Powtils or PSP or whatever it's called
> these days. My
> CGI app needs to permit uploading of files, but I got no
> idea how to
> do it.
> 
> Regards,
>   - Graeme -
> 
> 
> 
> On 6/6/07, Darius Blaszijk <[EMAIL PROTECTED]>
> wrote:
> > Thanks to all for their help. For now I will stick to
> psp because I need it
> > to work with 2.0.4.
> >
> >  Darius
> >
> >
> >  Michael Van Canneyt wrote:
> >
> > > On Tue, 5 Jun 2007, Darius Blaszijk wrote:
> > >
> > >
> > >
> > > > Hi I would like to upload a file through a
> web page. How can I do this
> > using
> > > > FPC? Is there any example available?
> > > >
> > > >
> > >
> > > The fpweb or cgiapp components can do this for
> you.
> > >
> > > 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] Exe size

2008-09-05 Thread Leonardo M . Ramé
Paul, can you post an example of what do you want to do? a couple of API calls 
your Win32 app is calling?. Maybe we can help translating those calls to the 
WinCE version (I'm pretty sure the functions will work without changes).

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Fri, 9/5/08, Tomas Hajny <[EMAIL PROTECTED]> wrote:

> From: Tomas Hajny <[EMAIL PROTECTED]>
> Subject: Re: [fpc-pascal] Exe size
> To: "FPC-Pascal users discussions" 
> Date: Friday, September 5, 2008, 2:13 PM
> On Fri, September 5, 2008 08:51, Paul wrote:
> 
> 
> Hi Paul,
> 
> >> If you use a (cross-)compiler for ARM target
> processor, the generated
> >> binary will be indeed an ARM binary, of course
> (ready to run on an
> >> ARM under the selected target OS - WinCE in your
> case). If targetting
> >> WinCE OS, you can only use WinCE RTL and/or other
> units prepared for
> >> that target, so if the particular API isn't
> supported for WinCE (as
> >> opposed to other WinXX platforms), it simply
> won't compile.
> >>
> >
> > This is bad news for me, I need control over the
> computer.
> > The Windows version of the program uses a lot of api
> calls.
> > Seems my only option is use Visual Studio :-(
> 
> Similarly to Felipe, I don't understand why this should
> be a bad news for
> you or why this should mean that Visual Studio gave you
> something not
> available with FPC (or what that "something" was
> in that case)... It looks
> as if I either don't understand what you meant with the
> statement above,
> or that I didn't express myself clearly and you
> understood me differently
> (and that Marco's additional explanation regarding
> relation between Win32
> and WinCE API hasn't helped to clarify that either).
> 
> Tomas
> 
> 
> ___
> 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] Exe size

2008-09-04 Thread Leonardo M . Ramé
Take a look at http://wiki.freepascal.org/KOL-CE, this project was specially 
started to create a "framework" for creating very small .exe applications using 
Delphi and FPC.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Thu, 9/4/08, Paul <[EMAIL PROTECTED]> wrote:

> From: Paul <[EMAIL PROTECTED]>
> Subject: Re: [fpc-pascal] Exe size
> To: "FPC-Pascal users discussions" 
> Date: Thursday, September 4, 2008, 4:03 PM
> If I understand correcly, it's the lcl that adds a huge
> part to the exe.
> Since I only use 1 small form, I could create it with api
> calls.
> But FPC for WinCE uses a crosscompiler, how do I have to
> implement this ?
> Are Windows api calls translated to ARM-calls ?
> 
> Paul
> ___
> 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