Re: [fpc-pascal] Mapping Cairo pixmap to FPC Bitmap and back

2014-09-22 Thread Giuliano Colla

Thanks a lot. Muito obrigado.

Giuliano

Il 22/09/2014 02:32, luiz americo pereira camara ha scritto:

https://code.google.com/p/luipack/source/browse/trunk/cairo/lcl/cairolcl.pas#152

https://code.google.com/p/luipack/source/browse/trunk/cairo/lcl/include/win32/cairolcl.inc#4

Direct bitmap data access (possible also with LCL.TBitmap in some cases)

https://code.google.com/p/luipack/source/browse/trunk/cairo/imaging/cairoimaging.pas#116

Luiz

2014-09-21 19:10 GMT-03:00 Giuliano Colla 
giuliano.co...@fastwebnet.it mailto:giuliano.co...@fastwebnet.it:


Could anyone more knowledgeable than me point me in the right
direction to find how a Cairo pixmap maps into a FPC Bitmap, and
possibly to some existing code for doing the trick of converting
from the one to the other, thus saving me hours of searching?

Thanks in advance for any hint.

Giuliano

___
fpc-pascal maillist  - fpc-pascal@lists.freepascal.org
mailto: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


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

Re: [fpc-pascal] Optimal number of threads for SMP

2014-09-22 Thread Michael Schnell

On 09/20/2014 01:48 AM, Graeme Geldenhuys wrote:

On 2014-09-15 10:19, Marco van de Voort wrote:

My rule of thumb is physical cores + a percentage. (like 10-20%).

Tell that to most developers out there, they clearly don't know that
rule of thumb. :-)  Mozilla Thunderbird under Win7 shows 47 threads.

Increasing Performance is only  one of the purposes you might have in 
mind when using threads. Traditionally threads are just that: 
unrelated threads of execution in a project, i.e. multitasking-tasks 
that share some memory.


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


Re: [fpc-pascal] Is is impossible to extend a generic class in fpc 2..6.4?

2014-09-22 Thread Dennis Poon

Sven Barth wrote:

  generic TMyMapTKey, TData = class(specialize TFPGMapTKey, TData)
  end; 


Thanks a lot for your help.

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


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

2014-09-22 Thread Vojtěch Čihák

Hi,
 
this is working code:
 
...
if not assigned(XMLDoc) then XMLDoc:=TXMLDocument.Create;
  with XMLDoc do
    begin
      if not assigned(DocumentElement) then
        begin
          aNode:=CreateElement(cRoot);
          AppendChild(aNode); 
        end;  
      if ASchemeNode='' then ASchemeNode:=cScheme;
      aNode:=DocumentElement.FindNode(ASchemeNode); 
      if not assigned(aNode) then
        begin
          aNode:=CreateElement(ASchemeNode);
          DocumentElement.AppendChild(aNode);
        end;  
   ...
end;  
 
so simply you have to create DocumentElement (i.e. root node) and append 
children there.
 
Vojtěch 
__

Od: Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com
Komu: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Datum: 22.09.2014 12:38
Předmět: [fpc-pascal] TDomNode to text and/or document


Hello,

I have a TDomNode (laz2_dom, but I guess it should be the same for all
implementations).

Is it possible to get a TXMLDocument from it? I tried:

 lDoc := TXMLDocument.Create;
 try
   lDoc.AppendChild(ANode);

but it crashes =(

Is it possible to get the full text of this node? something like:

svg bla blasub itemetc etc etc/subitem/svg

TextContent doesn't help at all here.

thanks,
--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 
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

[fpc-pascal] Lists of tuples

2014-09-22 Thread Mark Morgan Lloyd
Assuming that a tuple is a sequence of fields, accessible by position or 
name. Assuming that a list of tuples may significantly exceed available 
primary storage, and that individual tuples are accessed by some 
variation of First(), Next() etc.


As I understand it, this concept is central to the various database 
objects. Is it abstracted to a base class anywhere which can be used in 
other contexts without pulling in database-related libraries?


A trivial example of where this would be useful is manipulating a stream 
or file representing CSV data (e.g. from a potentially-large 
spreadsheet). Other examples include handling an array returned by a 
mathematical package (e.g. APL) where the input size is unknown, 
handling the results returned by a Prolog query applied to a large 
ruleset, and so on.


I'm not saying I need such a thing, and I accept that in many cases 
computers now have enough memory that a dynamic array is adequately 
efficient.


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

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


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

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

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

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

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


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

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

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


Re: [fpc-pascal] Freepascal templating engines with logical structures

2014-09-22 Thread luciano de souza
Thank you. The options you had me done are very intersting.

I want to show HTML grids and I intend to use a templating engine for
this purpose. But, in stead of embed logics in the template, I think I
need to organize better my code.

Perhaps, I need to build a class THMLTable where I could set a dataset
to be shown and paginated. And by means of a text property, I can fill
the template with one of the presented engines.

2014-09-17 1:51 GMT-03:00, luciano de souza luchya...@gmail.com:
 Hello all,

 I Know two templating engines for Freepascal: FPTemplate e JTemplate.
 Both can be successfully used for html construction.

 But they presents the same aspect: only searches and replaces tags to
 values.

 Of course, it's crucial. But to show html grids, obtained from
 database queries, it would be better if the templating engine had
 support for logical structures. Something like:

 table
 %
 for row in rows do
 begin
 write('tr');
 for cell in cells do
 writeln('td%s/td', [cell]);
 write('/tr');
 end;
 %
 /table

 It's only an example. The engine can use a syntax different from Pascal.

  But what I really like is not to use Javascript. Yes, in the Pascal
 side, I could write a JSON and certainly, there would be several
 Javascript libraries to show a grid from a JSON. However, I would like
 a pure Pascal solution.

 Are there templating engines in Pascal with support for logical structures?

 Regards,

 --
 Luciano de Souza



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


[fpc-pascal] Commandline to compile projects with generics

2014-09-22 Thread luciano de souza
Hello all,

I don't use Lazarus, but only Freepascal. Untill the generics advent,
I used to compile my projects with the following commandline:

fpc progname.pp

However, using generics, it was common an access violation in
compiling time. A friend said that codes with generics sould be
compiled with:

fpc progname.pp -B -Scghi -O1 -gw2 -godwarfsets -gl -vewnhi

Yes, it works, but why is it not possible to compile programs with
generics with the conventional method?

Regards,

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


[fpc-pascal] Persistent lists to save records

2014-09-22 Thread luciano de souza
Hello all,

Sometimes, I want only to save a simple file of records. The first
approach is record files, handled with reset, read, write and close of
CRT unit.

However, thereis an important limit. Strings can't exceed 255
characters. The $H switch can't be on.

So my question is: which are the easiest way to save records without
this limitation?

Is there something like a persistent list?

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


Re: [fpc-pascal] Commandline to compile projects with generics

2014-09-22 Thread leledumbo
 Yes, it works, but why is it not possible to compile programs with 
generics with the conventional method? 

Compiler bug, which luckily gets fixed by specifying additional compiler
options. In normal case, there should be no difference between compiling
non-generic and generic code WRT compiler option.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Commandline-to-compile-projects-with-generics-tp5720141p5720143.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


Re: [fpc-pascal] Persistent lists to save records

2014-09-22 Thread leledumbo
 So my question is: which are the easiest way to save records without this
limitation? 
 Is there something like a persistent list?

Not with static data record. That one do only support shortstrings, because
it contains actual data. Other strings are just pointers, which will be
saved as pointers as well, thus cannot be used for things like this. For
dynamic data, you have to work a little harder by using untyped file.
Dynamic data can easily be represented as length followed by data. Length
can be 1-n bytes, depending the maximum length of data you want to support.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Persistent-lists-to-save-records-tp5720142p5720144.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


Re: [fpc-pascal] Persistent lists to save records

2014-09-22 Thread luciano de souza
Hum... It's a very good idea. Firstly, I thought in something like a
persistent list with LoadFromFile and SaveTofile methods, but this
approach is really simple and useful.

2014-09-22 13:01 GMT-03:00, leledumbo leledumbo_c...@yahoo.co.id:
 So my question is: which are the easiest way to save records without this
 limitation?
 Is there something like a persistent list?

 Not with static data record. That one do only support shortstrings, because
 it contains actual data. Other strings are just pointers, which will be
 saved as pointers as well, thus cannot be used for things like this. For
 dynamic data, you have to work a little harder by using untyped file.
 Dynamic data can easily be represented as length followed by data. Length
 can be 1-n bytes, depending the maximum length of data you want to support.



 --
 View this message in context:
 http://free-pascal-general.1045716.n5.nabble.com/Persistent-lists-to-save-records-tp5720142p5720144.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



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


Re: [fpc-pascal] Commandline to compile projects with generics

2014-09-22 Thread luciano de souza
Wonderful! Generics are one of the best things has succeed in Freepascal.

I suppose this correction will be available in FPC 2.8. Is there some
prevision when it will be launched? A friend took a look at GIT
updates and he was very happy with the advances.
2014-09-22 12:51 GMT-03:00, leledumbo leledumbo_c...@yahoo.co.id:
 Yes, it works, but why is it not possible to compile programs with
 generics with the conventional method?

 Compiler bug, which luckily gets fixed by specifying additional compiler
 options. In normal case, there should be no difference between compiling
 non-generic and generic code WRT compiler option.



 --
 View this message in context:
 http://free-pascal-general.1045716.n5.nabble.com/Commandline-to-compile-projects-with-generics-tp5720141p5720143.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



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


Re: [fpc-pascal] Commandline to compile projects with generics

2014-09-22 Thread Sven Barth
Am 22.09.2014 15:53 schrieb luciano de souza luchya...@gmail.com:
 Yes, it works, but why is it not possible to compile programs with
 generics with the conventional method?

You are using a 2.6 series compiler, right? If so then this is likely fixed
in 2.7.1, which has vast improvements regarding generics.
There is no estimate when the next major release will be done as we have
not even branched it yet and once that is done it will take around 6 months
for release preparations.

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