[Lazarus] To all translators

2015-01-11 Thread Mattias Gaertner
Hi all,

A new svn branch for the next Lazarus release 1.4 (RC1) was created
under:

http://svn.freepascal.org/svn/lazarus/branches/fixes_1_4

It was created from trunk, so some translations need updates.
You can send translations for this release till 28th of
January.
Soon after that we will create release candidate 1 of 1.4.


Mattias

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


Re: [Lazarus] Lazarus 1.2 not compiling with FPC 3.0.1

2015-01-11 Thread zeljko

On 01/11/2015 04:23 AM, Anthony Walter wrote:

Oh, and here is an extra bit of information I neglected to mention. When
I use FPC 3.0.1 to compile against the trunk version of Lazarus, there
are no errors.

The point is, I think we should have a fixes version of Lazarus which
can build with the new fixes 3.0 version of FPC.


Don't expect that lazarus 1.2 will be changed to be compileable with fpc 
3.0 (in that case someone may ask same thing for lazarus 1.0). Trunk 
compiles with 3.0, so lazarus 1.4 will be able to compile with fpc-3.0.


zeljko


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


Re: [Lazarus] Lazarus 1.2 not compiling with FPC 3.0.1

2015-01-11 Thread Mark Morgan Lloyd

zeljko wrote:

On 01/11/2015 04:23 AM, Anthony Walter wrote:

Oh, and here is an extra bit of information I neglected to mention. When
I use FPC 3.0.1 to compile against the trunk version of Lazarus, there
are no errors.

The point is, I think we should have a fixes version of Lazarus which
can build with the new fixes 3.0 version of FPC.


Don't expect that lazarus 1.2 will be changed to be compileable with fpc 
3.0 (in that case someone may ask same thing for lazarus 1.0). Trunk 
compiles with 3.0, so lazarus 1.4 will be able to compile with fpc-3.0.


I'm currently trying to test some of the less-common architectures with 
the end-of-era 2.7.1 and Lazarus trunk. Obviously this is a personal 
effort, but on occasion some sort of marker indicating which 
version/revisions on the FPC and Lazarus svn systems /should/ work 
together would be useful.


I've had a lot of hardware problems over the last year, and in several 
cases finding the correct combination of compiler and LCL that would 
allow me to reconstruct a particular binary was tricky. I've spent a bit 
of time over the weekend working out ways that I can insert the svn 
revision numbers of all relevant parts (i.e. a project itself, FPC and 
Lazarus) into a binary when it's built, but that's not much help for 
some of the older binaries particularly those which had to be built with 
FPC 2.7.1 due to code generation issues.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

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


Re: [Lazarus] Lazarus 1.2 not compiling with FPC 3.0.1

2015-01-11 Thread Juha Manninen
On Sun, Jan 11, 2015 at 5:20 AM, Anthony Walter sys...@gmail.com wrote:
 There was a recent announcement on the free pascal mailing list that a new
 3.0 branch of the FPC was committed to svn.

 I decided to checkout a copy of the branch and using it with the latest
 official release of Lazarus, which I believe is 1.2.

Lazarus 1.2 is soon history. Use the new branch for 1.4 instead :
  svn.freepascal.org/svn/lazarus/branches/fixes_1_4/
Bug reports for it are welcome.

Juha

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


Re: [Lazarus] HEADS UP: FPC 3.0.1 stable branched off.

2015-01-11 Thread Joao Morais

Em 05/01/15 13:54, Marco van de Voort escreveu:

As a first step in the 3.0.0 release process the stable branch was branched
off to branches/fixes_3_0 and the version number was updated to 3.0.1


Which version the 3.0 branch will have just after 3.0 release?



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


Re: [Lazarus] Lazarus 1.2 not compiling with FPC 3.0.1

2015-01-11 Thread Anthony Walter
Juha,

Okay great. It looks like the 1.4 branch you mentioned was created by
mattias a few hours ago in revision 47333.

I'll be building installers to test Lazarus 1.4 and FPC 3.0 momentarily.
Installers will be for OSX, Linux, and Windows.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Inversion of control (IoC) and Dependency injection (DI)

2015-01-11 Thread silvioprog
On Mon, Jan 5, 2015 at 5:07 PM, luiz americo pereira camara 
luiz...@oi.com.br wrote:

 Starting a new thread.

 2015-01-05 15:16 GMT-03:00 silvioprog silviop...@gmail.com:

 On Mon, Jan 5, 2015 at 12:54 PM, Marco van de Voort mar...@stack.nl
 wrote:


 As a first step in the 3.0.0 release process the stable branch was
 branched
 off to branches/fixes_3_0 and the version number was updated to 3.0.1

 The version in trunk was raised to 3.1.1

 Scripts might need modification accordingly.


 Good news!

 Chances of custom attributes[1] (or something like this) in release 3.0?
 I have plans to use IoC[2] and DI using this feature.


 I created a IoC Container that can be found at
 https://code.google.com/p/luipack/source/browse/trunk/luicomponents/luiioccontainer.pas
 . It has no dependencies.


Awesome!

With it is possible to implement Service Locator and Property Injection
 patterns. Constructor Injection is not possible due to lacking of Extended
 RTTI support in fpc.


Can you send a small (and isolated) sample showing how to use it?


 While the C# crowd  praises the Constructor Injection pattern (
 http://www.devtrends.co.uk/blog/how-not-to-do-dependency-injection-the-static-or-singleton-container
 ), i had hard times figuring how it would work in real world / Lazarus
 projects. Also, polluting the constructor  signature is not something that
 i like. And finally with Constructor Injection is not possible to use with
 TComponent / TForm

 So in the end, i use the service locator and have plans to use Property
 Injection pattern

 BTW: Custom Attributes support would help to have a nicer Property
 Injection implementation


I've plan to use something like this (CDI inspirations: http://cdi-spec.org
):

The model:

uses
  My.Company.MySDK.EntityAttributes, My.Company.MySDK.TableAttributes ...;
type
  [Entity]
  [Table('products')]
  TProduct = class(TObject)
  public
[Id][GeneratedValue]
property Id: LongInt ...;
[ManyToOne][JoinColumn('OrderId')]
property OrderId: LontInt ...;
[NotNull][NotEmpty][Size(1, 10)][Unique]
property Name: String ...;
[Nulls][Lenght(100)][Unique]
property Description: String ...;
[MyCustomCurrConversion(TypeInfo(Currency), TypeInfo(String), ',0.00')]
[MyCustomMinMax('Price must be = %d and = %d.', [1, 1000])]
property Price: Currency ...;
  end;


The DAO:

type
  [RequestScoped]
  TProductDao = class(TObject)
  private
[Inject] property Session: TSession ... ;
[Transational] procedure Add(AProduct: TProduct);
...
  end;
...procedure TProductDao.Add(AProduct: TProduct);begin
  Session.Save(AProduct);end;


The *produces* (to use external libs like *JCore*):

type
  [ApplicationScoped]
  TSessionCreator = class(TObject)
  private
[Inject] property SessionFactory: TJCoreSession ... ;
[Produces] function GetSession: TSession;
...
  end;
...
TSessionCreator.GetSession: TSession;begin
  Result := ASessionFactory.OpenSession;end;

TSessionCreator.Close([Disposes]ASession: TSession) {begin  if
ASession.IsOpenASession.Close;end;


The controller:

uses
  My.Company.ControllerAttributes ... ;
type
  [Controller]
  TProcuctController = class(TObject)
  public
[Post][Transational] procedure Add([Valid] AProduct: TProduct); //
[Valid]: to validade properties
[Get][Path('./product')][Transational] procedure
List([Pagination('page={[0-9]}rows={[0-9]}')] AProducts:
TArrayListTProduct); // to paginate products
[Inject] property ProductDao: TProductDao ...; // inject DAO
[Inject] property Result: TResponse ...; // inject Response
  end;
...
procedure TProcuctController.Add(AProduct: TProduct);begin
  ProductDao.Add(AProduct);
  Result.SetAttribute(AProduct,
'product').RedirectTo(TProductController).List;end;
procedure TProcuctController.List(AProducts: TArrayListTProduct);begin
  Result.SetAttribute(AProducts, 'products'); // to create a variable
products in my BSP viewend;


The view:

html
ul
c:forEach items=${products} var=product
li ${product.name} - fmt:currency value=${product.price}
mask=R$ ,0.00//li
/c:forEach
/ul
/html


But I think that I'll still wait some years to make it possible in Free
Pascal hehe ...

-- 
Silvio Clécio
My public projects - github.com/silvioprog
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Read/write records from/to XML

2015-01-11 Thread Bart
Hi,

I have an XML file with the folowing structure:

?xml version=1.0 encoding=utf-8?
AppName
  Info
ApplicationVersie 3.0.1/Application
CopyRight(C) FooBar/CopyRight
WarningA message in a bottle/Warning
  /Info
  Persons Count=99
Person Index=000
  NameJan/Name
  CityBergentheim/City
  Emailj...@foobar.non/Email
/Person
Person Index=001
  NameMary/Name
  CityAmsterdam/City
  Emailm...@foobar.non/Email
/Person

  /Persons
/AppName

What would be the best/most simple way to:
- sequentially read Count persons
- find person with Index=X and read Name, City etc?

Currently I iterate through all nodes from the TXMlDocument I read
using ReadXMLFile() and parsing all Text-node values.
It goes something like this:

iNode := XMLDoc.FirstChild;
while iNode  nil do
begin
  ProcessNode(iNode,  0); // Recursive
  iNode := iNode.NextSibling;
end;

In ProcessNode I check the nodetype, construct the path, check if the
path is valid, determine if it is a name, city, some other field, or
invalid and store the value in the appropriate recordfield.

This is rather cumbersome.
Mosty, because I need (want) to check that e.g. a City node must be a
child of a Person node, which must be child of Persons node, which
must be child the root node.

E.g. if someone text-edits the file (that's the downside of making it
human-readable) and makes it like so:

...
  Persons Count=99
  NameKlaas/Name
Person Index=000
  NameJan/Name
  CityBergentheim/City
  Emailj...@foobar.non/Email
/Person

The NameKlaas/Name (whilst being legal xml) should be (silently)
disregarded.

So, I'm thinking I'm not using the most optimal method reading the
XML-file, certainly there must be suitable classes to do such a thing?

So, basically what I am looking for is, given the TXMlDocument object:
- find value of Persons/Count
- find Persons/Person with Index=X/Name

Preferrably I want a solution that does not drag in databse components
(the program is supposed to be stand-alone, no external libraries
should be needed).

Bart

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


Re: [Lazarus] Read/write records from/to XML

2015-01-11 Thread Anthony Walter
Have you considered xpath? It's a core feature of all xml engines (msxml,
libxml2, whatever else).

Syntax overview:

http://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx

In my wrapper would look like this:

Person := Document.FindNode('//Person[@Index = 0001]');

Other examples

// All persons in a city that start with the letter A
  Document.FindNodes('//Person[starts-with(City, A)]');
// Or to processing save time, select the Persons node
  People := Document.FindNode('//Persons');
// And now xpath is evaluated relative to that
  People.FindNode('Person[Name = Jan]');

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


Re: [Lazarus] Inversion of control (IoC) and Dependency injection (DI)

2015-01-11 Thread luiz americo pereira camara
2015-01-11 17:12 GMT-03:00 silvioprog silviop...@gmail.com:

 On Mon, Jan 5, 2015 at 5:07 PM, luiz americo pereira camara 
 luiz...@oi.com.br wrote:

 I created a IoC Container that can be found at
 https://code.google.com/p/luipack/source/browse/trunk/luicomponents/luiioccontainer.pas
 . It has no dependencies.


 Awesome!


Thanks.



 With it is possible to implement Service Locator and Property Injection
 patterns. Constructor Injection is not possible due to lacking of Extended
 RTTI support in fpc.


 Can you send a small (and isolated) sample showing how to use it?


There's a demo in demos/ioccontainer folder

In a real project, in the app start, i do:

  FPresentations := TPresentationManager.Create(Self);
  Services.Register(IPresentationManager, FPresentations);

When i need the service i do:

  FPresentations :=
IPresentationManager(Services.Resolve(IPresentationManager));

The global, nor the actual implementation is exposed, making easier to test.
There's still a dependency to the container (Services), this is the whole
point of criticism to service locator pattern.
In the other side there always be a place where the dependency is set, even
in other DI patterns.

BTW: Custom Attributes support would help to have a nicer Property
 Injection implementation


 I've plan to use something like this (CDI inspirations:
 http://cdi-spec.org):


Seems a full ORM plus a MVC like framework.

I'm more modest. I use these classes to make modular code thus a bit more
maintanable.

All in all i use the IoC container little, in my project i register only
two interfaces. In other places, i configure the dependency manually

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


Re: [Lazarus] Lazarus 1.2 not compiling with FPC 3.0.1

2015-01-11 Thread FreeMan

PLEASE !!!
who write installers, share uninstall script as well, no any info about 
where to file copied. why hide like a fusion formule ?
for fpc , copied same files to /bin, usr/ xxx  bla bla... my idea is, 
add in installed folder in fpc.cfg so no need to copy files.
for permission, define new group and installer folder owner set this 
group name (group name can fpc or/and lazarus [like a firebird]) who 
wantto use fpc or lazarus, user add to this created to groups.



On 11.01.2015 19:07, Anthony Walter wrote:

Juha,

Okay great. It looks like the 1.4 branch you mentioned was created by 
mattias a few hours ago in revision 47333.


I'll be building installers to test Lazarus 1.4 and FPC 3.0 
momentarily. Installers will be for OSX, Linux, and Windows.



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


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


Re: [Lazarus] TMPlayerControl

2015-01-11 Thread Michael Thompson
G'day,

On 11 January 2015 at 11:44, Andrew Haines andrewd...@aol.com wrote:

  I played with this for a few minutes and came up with this:
 MPlayerControl1.OnPlaying has to be assigned for
 MPlayerControl1.Position to work.

Oh.  Yes, I see...   That was by design - it never occurred to me that
someone would want to retrieve the .Position without having .OnPlaying
hooked up.

I put the checks in for FOnPlaying in an attempt to minimise chatter with
mplayer.   In my testing, I observed degraded playback if that chatter was
excessive.  In truth though - excessive was chatter at frequencies
approaching frame by frame querying, not at the frequency Position is
currently updated (twice a second).

Given the current architecture, what I *can't* do is obtain the position
when the user requests it.  I can either constantly query the position
(which is what I currently do when FOnPlaying is assigned) or never ask for
position.

As I see it, we've got 3 options:

1.  Maintain current code
2.  Always request Position from mplayer
3.  Add an Options Flag.  Only request Position if either
optRequestPosition or FOnPLaying assigned.

Now you've raised the issue, I'm not in favour of 1.  2 will introduce
overheads - but as we've seen when FOnPlaying is assigned, those overheads
aren't excessive.  3 preserves my original caution, but perhaps that's
unwarranted.

Now that there's a few items on the TODO list, let me know which you
prefer: 2) or 3) and I'll make the changes.

I'll get the .FullScreen property in at the same time (but sorry Pierre:  I
completely lack the knowledge or time to investigate mplayer working with
GL)

Many thanks for the feedback

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


Re: [Lazarus] TMPlayerControl

2015-01-11 Thread Andrew Haines

On 01/11/2015 09:57 PM, Michael Thompson wrote:

G'day,

On 11 January 2015 at 11:44, Andrew Haines andrewd...@aol.com 
mailto:andrewd...@aol.com wrote:

 I played with this for a few minutes and came up with this:
 MPlayerControl1.OnPlaying has to be assigned for
 MPlayerControl1.Position to work.

Oh.  Yes, I see...   That was by design - it never occurred to me that 
someone would want to retrieve the .Position without having .OnPlaying 
hooked up.






Given the current architecture, what I *can't* do is obtain the 
position when the user requests it.  I can either constantly query the 
position (which is what I currently do when FOnPlaying is assigned) or 
never ask for position.


As I see it, we've got 3 options:

1.  Maintain current code
2.  Always request Position from mplayer
3.  Add an Options Flag.  Only request Position if either 
optRequestPosition or FOnPLaying assigned.


Now you've raised the issue, I'm not in favour of 1.  2 will introduce 
overheads - but as we've seen when FOnPlaying is assigned, those 
overheads aren't excessive.  3 preserves my original caution, but 
perhaps that's unwarranted.


I'm not really sure it's an issue. My test was very minimal to create a 
fullscreen workaround. I imagine most programs would assign OnPlaying.




Now that there's a few items on the TODO list, let me know which you 
prefer: 2) or 3) and I'll make the changes.



I prefer 2.
3 seems over-engineered. :)

I'll get the .FullScreen property in at the same time (but sorry 
Pierre:  I completely lack the knowledge or time to investigate 
mplayer working with GL)


Many thanks for the feedback


:)

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


Re: [Lazarus] Lazarus 1.2 not compiling with FPC 3.0.1

2015-01-11 Thread Anthony Walter
I've been building FPC 3.0 and Lazarus 1.4 from svn sources. Here are some
problems.

First, all Linux builds seem to be working correctly.

On Windows though I encountered a few problems.

1) In lcl\interfaces\win32\win32callbacks.inc lines 1547 and 1571, the
following cannot compile:

  ItemState := TOwnerDrawState(PDrawItemStruct(LParam)^.itemState);

2) There is a similar problem in lcl/grids.pas:

  cfg.SetValue(AKey + '/style/value', Integer(AFont.Style)); // around
line 1905
  AFont.Style:= TFontStyles(cfg.GetValue(AKey + '/style/value', 0)); //
around line 1913
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] HEADS UP: FPC 3.0.1 stable branched off.

2015-01-11 Thread zeljko

On 01/11/2015 04:58 PM, Joao Morais wrote:

Em 05/01/15 13:54, Marco van de Voort escreveu:

As a first step in the 3.0.0 release process the stable branch was
branched
off to branches/fixes_3_0 and the version number was updated to 3.0.1


Which version the 3.0 branch will have just after 3.0 release?


fixes_3_0 will be ver. 3.0.2 (after 3.0.0 release).

zeljko


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


[Lazarus] What happened to this feature?

2015-01-11 Thread Anthony Walter
I saw a really great feature in Lazarus which was removed recently. I'm not
sure when or why, but am wondering if anyone knows what happened.

Here is a description of the feature:

When Lazarus running with the AnchorDockingDgn package installed, if you
clicked on a component in the palette, after the briefest moment Lazarus
would bring the current form designer to the foreground.

This would save you the step of having to click on a component then
pressing F12 to bring the form designer back to the front where you could
then drop the component.

I thought the feature worked great, but I'm not seeing it on my most recent
Lazarus builds. Where did this feature go?
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus