[Lazarus] How do use sockets?

2011-11-26 Thread Fabiano de Almeida
Hi all!

How do I create a socket server and client in Lazarus? In Delphi I used
the visual components of the ICS (Internet Component Suite from The
OverByte)

thank's

Fabiano.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do use sockets?

2011-11-26 Thread Fabiano de Almeida
on the wiki (http://wiki.lazarus.freepascal.org/Sockets), used an old
package. Can't compile on Lazarus from SVN.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Build project now rebuilds everithing

2011-11-26 Thread Juha Manninen
2011/11/26 cobines cobi...@gmail.com

 W dniu 2011-11-06 19:08, cobines pisze:

  However, weird thing. If I choose Build from menu then it doesn't seem
 to rebuild FCL, LCL, but if I start Build from a hotkey then it does.


 The call from menu item is:

 procedure TMainIDE.**mnuBuildProjectClicked(Sender: TObject);
 Begin
  DoBuildProject(crBuild,[**pbfCleanCompile]);
 end;

 but from hotkey the call is:

  ecBuild: DoBuildProject(crBuild, [pbfCleanCompile,
 pbfCompileDependenciesClean]);

 So, there is a difference. Which should it be? Since it seems to always
 rebuild packages when I use the hotkey I would think that [pbfCleanCompile]
 is correct.


Indeed there is a difference. I should have checked it properly.
Is it ok to remove pbfCompileDependenciesClean from the hotkey handler?

Juha
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do use sockets?

2011-11-26 Thread Felipe Monteiro de Carvalho
Use LNet: http://wiki.lazarus.freepascal.org/lNet
or Synapse: http://wiki.lazarus.freepascal.org/Synapse

LNet is better for single threaded applications and Synapse is better
for multi-threaded applications.

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Build project now rebuilds everithing

2011-11-26 Thread Mattias Gaertner
On Sat, 26 Nov 2011 11:26:40 +0200
Juha Manninen juha.mannine...@gmail.com wrote:

 2011/11/26 cobines cobi...@gmail.com
 
  W dniu 2011-11-06 19:08, cobines pisze:
 
   However, weird thing. If I choose Build from menu then it doesn't seem
  to rebuild FCL, LCL, but if I start Build from a hotkey then it does.
 
 
  The call from menu item is:
 
  procedure TMainIDE.**mnuBuildProjectClicked(Sender: TObject);
  Begin
   DoBuildProject(crBuild,[**pbfCleanCompile]);
  end;
 
  but from hotkey the call is:
 
   ecBuild: DoBuildProject(crBuild, [pbfCleanCompile,
  pbfCompileDependenciesClean]);
 
  So, there is a difference. Which should it be? Since it seems to always
  rebuild packages when I use the hotkey I would think that [pbfCleanCompile]
  is correct.
 
 
 Indeed there is a difference. I should have checked it properly.
 Is it ok to remove pbfCompileDependenciesClean from the hotkey handler?

Yes.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Build project now rebuilds everithing

2011-11-26 Thread Juha Manninen
2011/11/26 Mattias Gaertner nc-gaert...@netcologne.de

  Indeed there is a difference. I should have checked it properly.
  Is it ok to remove pbfCompileDependenciesClean from the hotkey handler?

 Yes.


Removed in r33794.

Juha
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Documenting constant values

2011-11-26 Thread Hans-Peter Diettrich
Delphi introduces very many constants, corresponding to WinAPI defines. 
The user has no idea which constants can be used in which place, because 
the argument types are almost DWORD - TCursor is a nice exception.


Can we agree to define range types or simple type alias for *all* such 
arguments, so that all related constants can be described together, in 
one single place? See the documentation on TCursor.


DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] FontCanUTF8(Font: HFont)

2011-11-26 Thread Hans-Peter Diettrich

Felipe Monteiro de Carvalho schrieb:

You have to read the implementations to see what the routines do, and
in this case it looks pretty clear that it is a legacy introduced
because LCL-gtk1 needed it.

It probably can be deprecated.


Reading the implementation doesn't help much, as can be seen with your 
example:



function TGTKWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
  Result:=IsValidGDIObject(Font)
{$IFDEF Gtk1}
and FontIsDoubleByteCharsFont(PGdiObject(Font)^.GDIFontObject)
{$ENDIF}
;
end;


What does *FontIsDoubleByteCharsFont* mean? This *might* mean UTF-16, 
but then the name *FontCanUTF8* already is wrong.



IMO a usable software should *not* require the user to guess, what 
various implementations *might* do. Instead the *implementors*, who 
*know* what to implement, should leave at least a small note on the 
purpose of every procedure or method. That's little work for the Lazarus 
team, which saves many months to the documentation writers :-]


Not to forget possibly or definitely wrong descriptions, as found in 
many places in the documentation :-(


DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Sending messages

2011-11-26 Thread Hans-Peter Diettrich

Mattias Gaertner schrieb:

On Fri, 25 Nov 2011 22:57:34 +0100
Hans-Peter Diettrich drdiettri...@aol.com wrote:


zeljko schrieb:

On Friday 25 of November 2011 14:33:16 Hans-Peter Diettrich wrote:


  And how does PostMessage fit into the picture?


I'm using PostMessage in an audio application to update position of 
trackbar on mainform from another thread where audio file is loaded and 
playing and it works ok (tested qt and gtk2)

This looks like PostMessage is thread-safe, but is not a proof.


Yes, PostMessage is thread safe.


Thanks.


The PostMessage function places (posts) a message in the message queue
and then returns without waiting.


What again raises the question, how many message queues are supported by 
the LCL, and what's required to use them. Until now I suppose that the 
LCL has no platform-independent model for thread message queues, and 
offers TApplication.QueueAsyncCall instead for cross-platform 
applications. Right?



I just wonder how a broadcast (to HWND_BROADCAST) works with 
SendMessage. But this is a feature that must not be supported for 
non-Windows platforms.


Do you mean need not?


Perhaps I meant must not necessarily

Englisch Sprak schwere Sprak ;-)


Qt have similar mechanism: SendEvent()  PostEvent() and it works in 
same way.

Are threads supported?


The more I try to understand the Lazarus message handling, the more 
questions arise :-(


QT functions are beyond the LCL docs.


Right, but the docs should be valid for *all* platforms. This requires 
to mention cross-platform issues (restrictions...), which affect 
portable applications. What's a method worth, like 
TWidgetset.SystemParameters, when it is only supported on Windows?


It would be nice to get not implemented errors or at least platform 
specific hints at *compile* time, not only when an application runs on 
a customer's machine.




The LCL does not support creating windows from other threads.
You can try doing that by calling the appropriate widget set functions
yourselves. But I don't know if that will work.
So, your question is somewhat theoretical, isn't it?


IMO the documentation of the TWidgetset base class is an essential part 
of the Lazarus documentation. It is not only required to understand the 
high-level LCL code, but also is a good place for the documentation of 
the named constants, usable as parameters in many methods across the 
entire LCL.


DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Sending messages

2011-11-26 Thread Hans-Peter Diettrich

Felipe Monteiro de Carvalho schrieb:

On Fri, Nov 25, 2011 at 2:33 PM, Hans-Peter Diettrich
drdiettri...@aol.com wrote:

This doesn't answer my question. What's the *source* of the processed
messages?

And how does PostMessage fit into the picture?


If this is for writing documentation, then you are clearly on the
wrong track here. Libraries work with the black box concept. The user
does not need to know where the messages from PostMessage are stored,
they are stored somewhere and will reappear sometime later in the
main thread. That's enough.


It's not enough *if* messages can end up in different message queues, 
and when the user has to implement explicit message handling e.g. in 
threads.



Any information of where the messages were in between is an
implementation detail which can change at any time. It also changes
from widgetset to widgetset.


You already mentioned multiple message loops in the LCL. That's fine 
when a user does not have to care about these loops. I only want to know 
whether (and how) a user may have to provide explicit message handling code.


E.g. it's well known that a single-threaded applications should call 
Application.ProcessMessages during lengthy tasks, in order to keep the 
GUI responsive. Is something like that required in threads, too, or what 
else is the suggested way for inter-thread communication, instead of 
sending messages?


E.g. TWidgetset.AllocHWND allows to create (hidden) windows, which then 
can receive messages. Does this allow to send messages to threads, on 
*all* platforms? Such functionality IMO *can* be implemented in the LCL, 
for all widgetsets, question is whether it will be supported *by 
design*, or only exists for Delphi/Win32 compatibility?


DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Documenting constant values

2011-11-26 Thread Felipe Monteiro de Carvalho
I think this should be discussed on a per-API basis. Please give a
concrete example.

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] FontCanUTF8(Font: HFont)

2011-11-26 Thread Felipe Monteiro de Carvalho
On Sat, Nov 26, 2011 at 10:27 AM, Hans-Peter Diettrich
drdiettri...@aol.com wrote:
 Reading the implementation doesn't help much, as can be seen with your
 example:

 What does *FontIsDoubleByteCharsFont* mean? This *might* mean UTF-16, but
 then the name *FontCanUTF8* already is wrong.

It doesn't matter what it does, the important thing is seeing that it
does something in LCL-Gtk1 and does nothing useful in all other
widgetsets. Gtk1 is obsolete, so the routine currently does nothing
useful.

 IMO a usable software should *not* require the user to guess

From what I see, users should not use this routine. As mentioned in my
previous e-mail it looks a legacy from the past when Lazarus still
used ansi-encoded strings in some widgetsets.

It does not look useful nowadays, so I propose deprecating it. Anyone opposed?

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] FontCanUTF8(Font: HFont)

2011-11-26 Thread Mattias Gaertner
On Sat, 26 Nov 2011 12:22:31 +0100
Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote:

 On Sat, Nov 26, 2011 at 10:27 AM, Hans-Peter Diettrich
 drdiettri...@aol.com wrote:
  Reading the implementation doesn't help much, as can be seen with your
  example:
 
  What does *FontIsDoubleByteCharsFont* mean? This *might* mean UTF-16, but
  then the name *FontCanUTF8* already is wrong.

AFAIR it means UCS2. The name DoubleByte is somewhat misleading.

 
 It doesn't matter what it does, the important thing is seeing that it
 does something in LCL-Gtk1 and does nothing useful in all other
 widgetsets. Gtk1 is obsolete, so the routine currently does nothing
 useful.
 
  IMO a usable software should *not* require the user to guess
 
 From what I see, users should not use this routine. As mentioned in my
 previous e-mail it looks a legacy from the past when Lazarus still
 used ansi-encoded strings in some widgetsets.

It's legacy. It has nothing to do with ansi-encoded. gtk1 had some fonts
that only supported 8bit.

 
 It does not look useful nowadays, so I propose deprecating it. Anyone opposed?

No objection here.

Mattias


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Postgres and Lazarus

2011-11-26 Thread Alexsander Rosa
My company uses PostgreSQL since 2002 and Lazarus since 2005.
Check our blog about the porting of our ERP from Delphi to Lazarus:
http://port2laz.blogspot.com/

2011/11/25 Everton Vieira tonvie...@gmail.com

 Hi people, anyone uses the combination of Postgres with Lazarus?

 I've been gotting a lot of problems with it:

 To create or drop database.
 To create or drop schema.
 To create or drop table.
 To create or drop index.

 Occurs erros. Specialy on Linux they happen. They aren't able to do this
 functions.

 Anyone has some experience with it?

 Att.
 Everton Vieira.

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




-- 
Atenciosamente,
Alexsander da Rosa
http://rednaxel.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Sending messages

2011-11-26 Thread Mattias Gaertner
On Sat, 26 Nov 2011 11:14:48 +0100
Hans-Peter Diettrich drdiettri...@aol.com wrote:

 Mattias Gaertner schrieb:
  On Fri, 25 Nov 2011 22:57:34 +0100
  Hans-Peter Diettrich drdiettri...@aol.com wrote:
  
  zeljko schrieb:
  On Friday 25 of November 2011 14:33:16 Hans-Peter Diettrich wrote:
 
 
And how does PostMessage fit into the picture?
 
 
  I'm using PostMessage in an audio application to update position of 
  trackbar on mainform from another thread where audio file is loaded and 
  playing and it works ok (tested qt and gtk2)
  This looks like PostMessage is thread-safe, but is not a proof.
  
  Yes, PostMessage is thread safe.
 
 Thanks.
 
  The PostMessage function places (posts) a message in the message queue
  and then returns without waiting.
 
 What again raises the question, how many message queues are supported by 
 the LCL, and what's required to use them. 

IMO, when the documentation uses the term LCL it should mean the the
library as whole or the platform independent part. The LCL interface
or LCL widget set is the glue between the LCL and the widget set.

The LCL has only one event queue, running in the main thread.
There are some specials in each widget set and/or LCL interface. But
these are implementation details, which can change any time.


 Until now I suppose that the 
 LCL has no platform-independent model for thread message queues, and 
 offers TApplication.QueueAsyncCall instead for cross-platform 
 applications. Right?

Yes.

 
  I just wonder how a broadcast (to HWND_BROADCAST) works with 
  SendMessage. But this is a feature that must not be supported for 
  non-Windows platforms.
  
  Do you mean need not?
 
 Perhaps I meant must not necessarily

Then yes. 

 
 Englisch Sprak schwere Sprak ;-)
 
 
  Qt have similar mechanism: SendEvent()  PostEvent() and it works in 
  same way.
  Are threads supported?
 
 
  The more I try to understand the Lazarus message handling, the more 
  questions arise :-(
  
  QT functions are beyond the LCL docs.
 
 Right, but the docs should be valid for *all* platforms.

QT functions are not valid for all LCL platforms.

 This requires 
 to mention cross-platform issues (restrictions...), which affect 
 portable applications. What's a method worth, like 
 TWidgetset.SystemParameters, when it is only supported on Windows?
 
 It would be nice to get not implemented errors or at least platform 
 specific hints at *compile* time, not only when an application runs on 
 a customer's machine.

Yes, that would be nice.
But many functions are not called directly by the application or are
compiled in, but never used.
Maybe a whole program optimization compile can show which
platform dependent functions are used.
But even this will show too many functions, e.g. functions that are
only called on special combinations of parameters.

Are the new modifiers (platform, unimplemented, experimental) in fpc 2.4.2?


  The LCL does not support creating windows from other threads.
  You can try doing that by calling the appropriate widget set functions
  yourselves. But I don't know if that will work.
  So, your question is somewhat theoretical, isn't it?
 
 IMO the documentation of the TWidgetset base class is an essential part 
 of the Lazarus documentation. It is not only required to understand the 
 high-level LCL code, but also is a good place for the documentation of 
 the named constants, usable as parameters in many methods across the 
 entire LCL.

Simply write, that the LCL is single threaded with a few exceptions.
Create windows and controls only with the main thread.
The LCL functions do not check if they are called by the main thread.


Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Sending messages

2011-11-26 Thread Mattias Gaertner
On Sat, 26 Nov 2011 11:50:53 +0100
Hans-Peter Diettrich drdiettri...@aol.com wrote:

 Felipe Monteiro de Carvalho schrieb:
  On Fri, Nov 25, 2011 at 2:33 PM, Hans-Peter Diettrich
  drdiettri...@aol.com wrote:
  This doesn't answer my question. What's the *source* of the processed
  messages?
  And how does PostMessage fit into the picture?
  
  If this is for writing documentation, then you are clearly on the
  wrong track here. Libraries work with the black box concept. The user
  does not need to know where the messages from PostMessage are stored,
  they are stored somewhere and will reappear sometime later in the
  main thread. That's enough.
 
 It's not enough *if* messages can end up in different message queues, 
 and when the user has to implement explicit message handling e.g. in 
 threads.

Maybe you should give people some time to answer your mails, before
writing several mails all based on the same misunderstanding.

The LCL is event driven, and it does not matter how many event queues
there are behind the scenes.
As always it gets a more complicated with multithreading. Other
threads can only produce events via PostMessage, QueueAsyncCall,
TThread.Synchronize or RTL functions.
In any case the LCL executes the events only via the main thread. 

 
  Any information of where the messages were in between is an
  implementation detail which can change at any time. It also changes
  from widgetset to widgetset.
 
 You already mentioned multiple message loops in the LCL. That's fine 
 when a user does not have to care about these loops. I only want to know 
 whether (and how) a user may have to provide explicit message handling code.
 
 E.g. it's well known that a single-threaded applications should call 
 Application.ProcessMessages during lengthy tasks, in order to keep the 
 GUI responsive. Is something like that required in threads, too, or what 
 else is the suggested way for inter-thread communication, instead of 
 sending messages?

The Application.ProcessMessages is only needed by the main
thread and must only be called by the main thread (like most LCL
functions).

 
 E.g. TWidgetset.AllocHWND allows to create (hidden) windows, which then 
 can receive messages. Does this allow to send messages to threads, on 
 *all* platforms? Such functionality IMO *can* be implemented in the LCL, 
 for all widgetsets, question is whether it will be supported *by 
 design*, or only exists for Delphi/Win32 compatibility?

TWidgetset.AllocHWND is WinAPI specific.
If you use this you leave the safe harbor of the LCL.
Then you have to read the WinAPI docs and see the implementation of the
LCL interface code, e.g. for win32.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TWidgetSet.GetTextExtentExPoint

2011-11-26 Thread Hans-Peter Diettrich
The loop in this method is a bit weird. When the best fit is found, the 
loop continues but does nothing. IMO it should break instead, or fill 
the remaining array elements with defined values.


When both MaxCount and PartialWidths are Nil, the loop must not even be 
entered.


DoDi

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TWidgetSet.GetTextExtentExPoint

2011-11-26 Thread Felipe Monteiro de Carvalho
Indeed it could be more optimized, I'll see about that later on, but
note that this purely a question of optimization not correctness.

If MaxCount=PartialWidths=nil then you are using the wrong routine.

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Documenting constant values

2011-11-26 Thread Hans-Peter Diettrich

Felipe Monteiro de Carvalho schrieb:

I think this should be discussed on a per-API basis. Please give a
concrete example.


I gave it already: TCursor.

The generated help links the cursor parameters to the TCursor 
documentation, for all procedures and methods. Now it's clear, to the 
user and documentation writer, where the related constants are (to be) 
documented.


DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Sending messages

2011-11-26 Thread Hans-Peter Diettrich

Mattias Gaertner schrieb:


Maybe you should give people some time to answer your mails, before
writing several mails all based on the same misunderstanding.


ACK


E.g. TWidgetset.AllocHWND allows to create (hidden) windows, which then 
can receive messages. Does this allow to send messages to threads, on 
*all* platforms? Such functionality IMO *can* be implemented in the LCL, 
for all widgetsets, question is whether it will be supported *by 
design*, or only exists for Delphi/Win32 compatibility?


TWidgetset.AllocHWND is WinAPI specific.
If you use this you leave the safe harbor of the LCL.


I'd like to see such statements for all TWidgetset methods, other users 
may want that, too.


Can the lclintfh/winapih separation be used to distinguish between 
methods available in all widgetsets, and purely Windows specific 
extensions (for Delphi compatibility only)?


DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Documenting constant values

2011-11-26 Thread Sven Barth

On 26.11.2011 14:14, Hans-Peter Diettrich wrote:

Felipe Monteiro de Carvalho schrieb:

I think this should be discussed on a per-API basis. Please give a
concrete example.


I gave it already: TCursor.

The generated help links the cursor parameters to the TCursor
documentation, for all procedures and methods. Now it's clear, to the
user and documentation writer, where the related constants are (to be)
documented.


The problem with this concrete example is that you can easily (at least 
on Windows) add custom cursors. I don't know whether you have ever done 
that in Delphi (I haven't), but here is an example I quickly found: 
http://delphiforfun.org/programs/Delphi_Techniques/CustomCursors.htm


Note: I don't know whether Lazarus supports this.

Regards,
Sven


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Sending messages

2011-11-26 Thread Hans-Peter Diettrich

Mattias Gaertner schrieb:

It would be nice to get not implemented errors or at least platform 
specific hints at *compile* time, not only when an application runs on 
a customer's machine.


Yes, that would be nice.
But many functions are not called directly by the application or are
compiled in, but never used.
Maybe a whole program optimization compile can show which
platform dependent functions are used.
But even this will show too many functions, e.g. functions that are
only called on special combinations of parameters.

Are the new modifiers (platform, unimplemented, experimental) in fpc 2.4.2?


Yes :-)

DoDi

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TSQLite3Connection setting itself to active in the designer

2011-11-26 Thread Bernd
I have made a strange observation: I have a form with a
TSQLite3Connection and all the other components needed to drive a
TDBGrid and everything is working fine. There is only one thing that
initially caused me problems until I found out what it was: When the
connection component is set to active at design time and I run my
application then sometimes when doing a commit it says database
locked. The solution was to make sure it is set to active=False in
the designer and only activate it at runtime.

But now after making sure that everything is set to inactive I still
occasionally have the problem that suddenly I got my database locked
problems again during debugging and after looking into the connection
component something (not me) has set it to active again. I cannot
reproduce what exactly is causing this. I am absolutely sure I did not
change any of the TSQLQuery components or any other connected
component to active the last time it happened (today) The only thing I
can remember having done since yesterday (the last time I had to
deactivate it) was adjusting some positions and anchors on the form. I
tried to reproduce it but without success.

Its not really ultra dramatic, I can leave the DatabaseName property
empty (which is what I have done now) this will prevent it completely
from being activated at all. Strangely it does NOT help setting it to
a different copy of the sqlite file, for some reasons this will not
prevent the database is locked errors.

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Postgres and Lazarus

2011-11-26 Thread Everton Vieira
In create table return: Access violation. in create database return:
Database not assign.

There's must be some tip to do this operation at least in Linux enviroment.
I'm using openSuse.
Anyone knows something about it?

2011/11/26 zeljko zel...@holobit.net

 **

 On Friday 25 of November 2011 20:15:26 Everton Vieira wrote:

  Hi people, anyone uses the combination of Postgres with Lazarus?

 

  I've been gotting a lot of problems with it:

 

  To create or drop database.

  To create or drop schema.

  To create or drop table.

  To create or drop index.

 

  Occurs erros. Specialy on Linux they happen. They aren't able to do this

  functions.


 What errors ?


  Anyone has some experience with it?


 Yes, using postgres for  12 yrs, and with lazarus for 3 yrs. So what's
 your exact problem ?


 zeljko

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




-- 
Everton Vieira.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Postgres and Lazarus

2011-11-26 Thread silvioprog
2011/11/26 Everton Vieira tonvie...@gmail.com:
 In create table return: Access violation. in create database return:
 Database not assign.

 There's must be some tip to do this operation at least in Linux enviroment.
 I'm using openSuse.
 Anyone knows something about it?

See this issue:

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

-- 
Silvio Clécio
===
Blog - silvioprog.com.br
Twitter - twitter.com/silvioprog
Facebook - facebook.com/silvioprog
LazSolutions - code.google.com/p/lazsolutions
Lazarus-BR - groups.google.com.br/group/lazarus-br?hl=pt-BR
===
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
===
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Postgres and Lazarus

2011-11-26 Thread Everton Vieira
Yeah, eu que iniciei, em windows realmente funciona o CreateDB, mas não ta
funcionando numa instalção openSuse. Eu não consigo mas reportar naquele
issue, ele já está fechado.

2011/11/26 silvioprog silviop...@gmail.com

 2011/11/26 Everton Vieira tonvie...@gmail.com:
  In create table return: Access violation. in create database return:
  Database not assign.
 
  There's must be some tip to do this operation at least in Linux
 enviroment.
  I'm using openSuse.
  Anyone knows something about it?

 See this issue:

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

 --
 Silvio Clécio
 ===
 Blog - silvioprog.com.br
 Twitter - twitter.com/silvioprog
 Facebook - facebook.com/silvioprog
 LazSolutions - code.google.com/p/lazsolutions
 Lazarus-BR - groups.google.com.br/group/lazarus-br?hl=pt-BR
 ===
* Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
 ===
 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




-- 
Everton Vieira.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Postgres and Lazarus

2011-11-26 Thread silvioprog
2011/11/26 Everton Vieira tonvie...@gmail.com:
 Yeah, eu que iniciei, em windows realmente funciona o CreateDB, mas não ta
 funcionando numa instalção openSuse. Eu não consigo mas reportar naquele
 issue, ele já está fechado.

http://code.google.com/p/lazarus-br/source/browse/trunk/tip/Install-LibPQ-openSuse.txt

You need create the synbolic link of lib of the PG.

{Você precisa criar o link da lib do PG}

-- 
Silvio Clécio
===
Blog - silvioprog.com.br
Twitter - twitter.com/silvioprog
Facebook - facebook.com/silvioprog
LazSolutions - code.google.com/p/lazsolutions
Lazarus-BR - groups.google.com.br/group/lazarus-br?hl=pt-BR
===
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
===

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Postgres and Lazarus

2011-11-26 Thread silvioprog
Em 26 de novembro de 2011 16:48, silvioprog silviop...@gmail.com escreveu:
 2011/11/26 Everton Vieira tonvie...@gmail.com:
 Yeah, eu que iniciei, em windows realmente funciona o CreateDB, mas não ta
 funcionando numa instalção openSuse. Eu não consigo mas reportar naquele
 issue, ele já está fechado.

 http://code.google.com/p/lazarus-br/source/browse/trunk/tip/Install-LibPQ-openSuse.txt

 You need create the synbolic link of lib of the PG.

 {Você precisa criar o link da lib do PG}

... and have permission to do so.

-- 
Silvio Clécio
===
Blog - silvioprog.com.br
Twitter - twitter.com/silvioprog
Facebook - facebook.com/silvioprog
LazSolutions - code.google.com/p/lazsolutions
Lazarus-BR - groups.google.com.br/group/lazarus-br?hl=pt-BR
===
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
===

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Postgres and Lazarus

2011-11-26 Thread Everton Vieira
zypper install postgresql-devel

Segunda-feira testarei. Muito obrigado.

[]'s Everton.

Em 26 de novembro de 2011 16:50, silvioprog silviop...@gmail.com escreveu:

 Em 26 de novembro de 2011 16:48, silvioprog silviop...@gmail.com
 escreveu:
  2011/11/26 Everton Vieira tonvie...@gmail.com:
  Yeah, eu que iniciei, em windows realmente funciona o CreateDB, mas não
 ta
  funcionando numa instalção openSuse. Eu não consigo mas reportar naquele
  issue, ele já está fechado.
 
 
 http://code.google.com/p/lazarus-br/source/browse/trunk/tip/Install-LibPQ-openSuse.txt
 
  You need create the synbolic link of lib of the PG.
 
  {Você precisa criar o link da lib do PG}

 ... and have permission to do so.

 --
 Silvio Clécio
 ===
 Blog - silvioprog.com.br
 Twitter - twitter.com/silvioprog
 Facebook - facebook.com/silvioprog
 LazSolutions - code.google.com/p/lazsolutions
 Lazarus-BR - groups.google.com.br/group/lazarus-br?hl=pt-BR
 ===
* Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
 ===

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




-- 
Everton Vieira.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do use sockets?

2011-11-26 Thread Bernd
2011/11/26 Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com:
 Use LNet: http://wiki.lazarus.freepascal.org/lNet
 or Synapse: http://wiki.lazarus.freepascal.org/Synapse

 LNet is better for single threaded applications and Synapse is better
 for multi-threaded applications.

I recently made (but never completed) a multi-threaded client
application with LNet (Linux and Windows), the multithreaded
networking stuff worked like a charm. I could not observe any
problems.

If I were required to begin developing another networking application
tomorrow I would choose LNet again.

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TSQLite3Connection setting itself to active in the designer

2011-11-26 Thread Martin Schreiber
On 11/26/2011 07:17 PM, Bernd wrote:
 
 Its not really ultra dramatic, I can leave the DatabaseName property
 empty (which is what I have done now) this will prevent it completely
 from being activated at all. Strangely it does NOT help setting it to
 a different copy of the sqlite file, for some reasons this will not
 prevent the database is locked errors.
 
A hint: in order to prevent locks of the running project from the active
design time instance set packetrecords of the datasets to -1. An open
data cursor locks the Sqlite data file.

Martin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do use sockets?

2011-11-26 Thread Graeme Geldenhuys
On 26/11/2011, Bernd prof7bit@ wrote:

 If I were required to begin developing another networking application
 tomorrow I would choose LNet again.

Is LNet still being developed. The last time I checked, nothing has
changed in the last year or two - or maybe I was just looking in the
wrong place.

The other problem with LNet is that it doesn't have a lot of TCP
protocols implemented.

Why not simply use Indy 10.5.x. I've just started using it in a FPC
project (using the to be released FPC 2.6.0 code), and so far I
haven't detected any major problems. Currently I only use the HTTP
(client  server) components from Indy, but will soon start using the
FTP (client  server), SMTP and NNTP protocols too.

-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Build project now rebuilds everithing

2011-11-26 Thread cobines
2011/11/26 Juha Manninen juha.mannine...@gmail.com:
 Removed in r33794.
 Juha

Thanks.

--
cobines

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Changing a TLabel.Caption

2011-11-26 Thread Timothy Groves
I tried changing a TLabel.Caption property, and got a SIGSEGV.  Here's 
the offending code:


if (cmbProfileMeasures.Text = 'Inches') then
  begin
  labPDFWidth.Caption := 'in X';
  labPDFHeight.Caption := 'in';
end
else
  if (cmbProfileMeasures.Text = 'Points') then
  begin
  labPDFWidth.Caption := 'pt X';
  labPDFHeight.Caption := 'pt X';
  end
else
begin
  labPDFWidth.Caption := 'cm X';
  labPDFHeight.Caption := 'cm X';
  end;

I am using Lazarus 0.9.30-2build1 on LUbuntu 11.10.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Changing a TLabel.Caption

2011-11-26 Thread Juha Manninen
2011/11/26 Timothy Groves the.tail.kin...@gmail.com

 I tried changing a TLabel.Caption property, and got a SIGSEGV.  Here's the
 offending code:

 if (cmbProfileMeasures.Text = 'Inches') then
  begin
  labPDFWidth.Caption := 'in X';
  labPDFHeight.Caption := 'in';
end
else
  if (cmbProfileMeasures.Text = 'Points') then
  begin
  labPDFWidth.Caption := 'pt X';
  labPDFHeight.Caption := 'pt X';
  end
else
begin
  labPDFWidth.Caption := 'cm X';
  labPDFHeight.Caption := 'cm X';
  end;


The controls (and form) are not created for some reason.
The code itself looks OK.

Juha
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do use sockets?

2011-11-26 Thread Bernd
2011/11/26 Graeme Geldenhuys graemeg.li...@gmail.com:
 On 26/11/2011, Bernd prof7bit@ wrote:

 If I were required to begin developing another networking application
 tomorrow I would choose LNet again.

 Is LNet still being developed. The last time I checked, nothing has
 changed in the last year or two - or maybe I was just looking in the
 wrong place.

3 months, so there are still some signs of life:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/lnet/?root=fpcprojects

 The other problem with LNet is that it doesn't have a lot of TCP
 protocols implemented.

This might be a valid point, depending on what you need it for.

When I think about network applications I always see myself
implementing some obscure rare protocols that sometimes don't even
have a name. In my case I needed it for implementing the bitcoin p2p
protocol and I already considered doing it with naked sockets alone
when I read that bitcoin might eventually switch to using SSL in the
near future. lNet seemed to me the simplest way to be prepared for
this without needing to depend on a monstrous library of which I would
only use 1%.


PS: I have stopped working on this one after It has become clear that
bitcoin with its massive design flaws can not survive. The remains of
my attempted half-finished pascal implementation are buried here:
http://code.google.com/p/fpbitcoin/source/browse/trunk (R.I.P.)

The code that is using lNet is in bitcoin_p2p_peer.inc.pas Its a
thread that makes a connection to another client. LNet calls the
callback methods that are assigned in the constructor. The main
program starts a hand full of these threads to always stay connected
with a few peers. Incoming connections are not yet implemented.

If I remember correctly the trick to get blocking IO with lNet was to
set the timeout to a non-zero value, then CallAction() will be a
blocking call (with a timeout) and then you can easily use one thread
per connection.

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do use sockets?

2011-11-26 Thread Felipe Monteiro de Carvalho
On Sat, Nov 26, 2011 at 9:23 PM, Graeme Geldenhuys
graemeg.li...@gmail.com wrote:
 Is LNet still being developed.

I sent some patches some months ago including perl-like regular
expression integration into TLTelnet, but from what I remember
Almindor never answered my mails.

Maybe I should just commit directly, probably I have commit rights.

 Why not simply use Indy 10.5.x.

I checked Indy some time ago because there was a bounty but I was
quite lost at how to use it, it seamed much more complex then lnet /
synapse.

I also disliked that from their website I got the feeling that Indy is
just a legacy, it seams they have a new version written in C#. From my
experience this is a strong sign to be very suspicious of them. If
they prefered to reimplement from zero instead of using the Pascal
version from .NET projects I have strong doubts about their commitment
to the Pascal version. The tendency of people that support two APIs
which do the same is eventually dropping one of them (for example the
removal of Carbon from Mac x86_64)

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus