Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Tony Whyman
Reiner,

You can certainly do this with IBX for Lazarus
(http://www.mwasoftware.co.uk). You will also find there some guidelines
on using the Firebird embedded library under both Windows and Linux that
are more general than just IBX.

If you want to stick with SQLDB then there is a global variable
UseEmbeddedFirebird that you need to set to force use of the embedded
library.

On 03/08/11 06:39, Reinier Olislagers wrote:
> When using the Firebird embedded database, it's nice to be able to
> create the database using only FreePascal/Lazarus.
>
> Is there a way to do this, e.g. using the SQLScript component, using
> something like this:
> const
>   DatabaseFile = 'DATABASE1.FDB';
> var
>   CreateScript: TSQLScript;
>   ScriptText: TStringList;
> begin
>   //Connection to Firebird database
>   IBConnection1.HostName := ''; //must be empty for embedded Firebird;
> must be filled for client/server Firebird
>   IBConnection1.DatabaseName := DatabaseFile; //Filename of Firebird
> database
>   IBConnection1.Username := 'SYSDBA';
>   IBConnection1.Password := 'masterkey'; //default password for SYSDBA
>   IBConnection1.Charset := 'UTF8'; //Send and receive string data in
> UTF8 encoding
>   IBConnection1.Dialect := 3; //Nobody uses 1 or 2 anymore.
>   if (FileExists(DatabaseFile)=false) then
>   begin
> CreateScript := TSQLScript.Create(nil);
> ScriptText:=TStringList.Create;
> try
>   CreateScript.OnException:=@ExceptionHandler;
>   IBConnection1.DatabaseName:='';
>   CreateScript.DataBase:=IBConnection1;
>   CreateScript.Transaction:=SQLTransaction1;
>   IBConnection1.Open;
>   SQLTransaction1.StartTransaction;
>
>   ScriptText.Text:='CREATE DATABASE ''database1.fdb'' page_size
> 16384  user ''SYSDBA'' password ''masterkey'' default character set UTF8;';
>   CreateScript.Script:=ScriptText;
>   CreateScript.ExecuteScript;
>   SQLTransaction1.Commit;
>
>   SQLTransaction1.StartTransaction;
>   ScriptText.Text:='CREATE TABLE Table1 (id VARCHAR(255), name
> VARCHAR(255));';
>   CreateScript.Script:=ScriptText;
>   CreateScript.ExecuteScript;
>   SQLTransaction1.Commit;
>
>   IBConnection1.Close;
> finally
>   ScriptText.Free;
>   CreateScript.Free;
> end;
>   end;
> ___
> 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 WebP support

2011-08-03 Thread Graeme Geldenhuys
On 1 August 2011 15:09, Michael Van Canneyt  wrote:
>>
>>  http://code.google.com/speed/webp/
>
> Not yet. But it looks very interesting.

It does indeed. I'm continuing work on adding FPImage support to
fpGUI, and was curious about WebP because I read an article on it
recently.


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-03 Thread Graeme Geldenhuys
On 1 August 2011 16:32, Michael Van Canneyt wrote:
>
> If you really want the application running 100% of the time, there are only
> 2 options:
> - fastcgi with mod_fastcgi (NOT mod_fcgid) and ExternalFastCGIServer option.
> - Embedded server (i;e. the application acts as a webserver).

...and option 3.
Application on the server (as a daemon or service or something), and
the CGI app is simply acting as a proxy. I did test this in a small
test case and it worked well - no idea how well it will scale though.

But the other two options are probably easier to program.


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Reinier Olislagers
On 3-8-2011 9:48, Tony Whyman wrote:
> Reiner,
> 
> You can certainly do this with IBX for Lazarus
> (http://www.mwasoftware.co.uk). You will also find there some guidelines
> on using the Firebird embedded library under both Windows and Linux that
> are more general than just IBX.
> 
> If you want to stick with SQLDB then there is a global variable
> UseEmbeddedFirebird that you need to set to force use of the embedded
> library.
> 
Thanks for the suggestion, Tony. I did download and install IBX, but
then I found bug report
http://bugs.freepascal.org/view.php?id=13340
with sample code for regular sqldb.

Adapted this code*:

(*Note: if you don't specify UseEmbeddedFirebird, you can rename
fbembed.dll to fbclient.dll and get the same results - I'd wish somebody
would implement the provided fix in issue
http://bugs.freepascal.org/view.php?id=17664)

//requires ibase60dyn in uses:
  UseEmbeddedFirebird:=true;
  IBConnection1.HostName := '';
  IBConnection1.DatabaseName := DatabaseFile; //
  IBConnection1.Username := 'SYSDBA';
  IBConnection1.Password := 'masterkey';
  IBConnection1.Charset := 'UTF8';
  IBConnection1.Dialect := 3;
  DBParams:=TStringList.Create;
  try
DBParams.Add('PAGE_SIZE=16384');
IBConnection1.Params := DBParams;
  finally
  DBParams.Free;
  end;

  if (FileExists(DatabaseFile)=false) then
  begin
  SQLTransaction1.Active:=false;
  IBConnection1.Transaction:=SQLTransaction1;
  IBConnection1.CreateDB; //Create the database file.

  IBConnection1.Open;
  SQLTransaction1.StartTransaction;
  IBConnection1.ExecuteDirect('CREATE TABLE Table1 (id VARCHAR(255),
name VARCHAR(255));');
  SQLTransaction1.Commit;
  IBConnection1.Close;
  end;

  //Finally switch on connection
  IBConnection1.Connected := True;
  IBConnection1.KeepConnection := True;
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPImage and WebP support

2011-08-03 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> >
> > Not yet. But it looks very interesting.
> 
> It does indeed. I'm continuing work on adding FPImage support to
> fpGUI, and was curious about WebP because I read an article on it
> recently.

If you look around a bit you see also a lot of criticism. On the results of
Google's tests, and the incompleteness of the reference implementation.

http://x264dev.multimedia.cx/archives/541
http://muizelaar.blogspot.com/2011/04/webp.html

And of course browser support is still seriously lacking.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE : [fpc-pascal] FPImage and WebP support

2011-08-03 Thread Ludo Brands


> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org 
> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part 
> de Marco van de Voort
> Envoyé : mercredi 3 août 2011 11:37
> À : FPC-Pascal users discussions
> Objet : Re: [fpc-pascal] FPImage and WebP support
> 
> 
> In our previous episode, Graeme Geldenhuys said:
> > >
> > > Not yet. But it looks very interesting.
> > 
> > It does indeed. I'm continuing work on adding FPImage support to 
> > fpGUI, and was curious about WebP because I read an article on it 
> > recently.
> 
> If you look around a bit you see also a lot of criticism. On 
> the results of Google's tests, and the incompleteness of the 
> reference implementation.
> 
> http://x264dev.multimedia.cx/archives/541
> http://muizelaar.blogspot.com/2011/04/webp.html
> 
> And of course browser support is still seriously lacking. 

And api documentation isn't complete:
http://code.google.com/speed/webp/docs/api.html#encodingapi

Ludo

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


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Michael Van Canneyt



On Wed, 3 Aug 2011, Reinier Olislagers wrote:


When using the Firebird embedded database, it's nice to be able to
create the database using only FreePascal/Lazarus.


Why do you think this is not possible ? The CreateDB method of TIBConnection 
does exactly that.

I've been using it for years.

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


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Tony Whyman
Actually, my preference for creating a database in a deployed
application is to first create it on my local system using isql with
input from a  script and then to save it using gbak in a portable
format. The TIBRestoreService is then used to create the database from
the backup archive when your program fails to detect a local database copy.

The advantages of this approach are that:

- you only ever have one file to distribute

- backup/restore is very robust and quick

- you can readily add Blob data to your archive and distribute it as
part of the archive

- the initial database is consistent across all deployments

Scripts tend to be more useful when issuing patches to existing
databases. In this case, simply calling isql from your program and
pointing it at a patch script can be much easier than embedding SQL
execution in your program.

On 03/08/11 10:18, Reinier Olislagers wrote:
> On 3-8-2011 9:48, Tony Whyman wrote:
>> Reiner,
>>
>> You can certainly do this with IBX for Lazarus
>> (http://www.mwasoftware.co.uk). You will also find there some guidelines
>> on using the Firebird embedded library under both Windows and Linux that
>> are more general than just IBX.
>>
>> If you want to stick with SQLDB then there is a global variable
>> UseEmbeddedFirebird that you need to set to force use of the embedded
>> library.
>>
> Thanks for the suggestion, Tony. I did download and install IBX, but
> then I found bug report
> http://bugs.freepascal.org/view.php?id=13340
> with sample code for regular sqldb.
>
> Adapted this code*:
>
> (*Note: if you don't specify UseEmbeddedFirebird, you can rename
> fbembed.dll to fbclient.dll and get the same results - I'd wish somebody
> would implement the provided fix in issue
> http://bugs.freepascal.org/view.php?id=17664)
>
> //requires ibase60dyn in uses:
>   UseEmbeddedFirebird:=true;
>   IBConnection1.HostName := '';
>   IBConnection1.DatabaseName := DatabaseFile; //
>   IBConnection1.Username := 'SYSDBA';
>   IBConnection1.Password := 'masterkey';
>   IBConnection1.Charset := 'UTF8';
>   IBConnection1.Dialect := 3;
>   DBParams:=TStringList.Create;
>   try
> DBParams.Add('PAGE_SIZE=16384');
> IBConnection1.Params := DBParams;
>   finally
>   DBParams.Free;
>   end;
>
>   if (FileExists(DatabaseFile)=false) then
>   begin
>   SQLTransaction1.Active:=false;
>   IBConnection1.Transaction:=SQLTransaction1;
>   IBConnection1.CreateDB; //Create the database file.
>
>   IBConnection1.Open;
>   SQLTransaction1.StartTransaction;
>   IBConnection1.ExecuteDirect('CREATE TABLE Table1 (id VARCHAR(255),
> name VARCHAR(255));');
>   SQLTransaction1.Commit;
>   IBConnection1.Close;
>   end;
>
>   //Finally switch on connection
>   IBConnection1.Connected := True;
>   IBConnection1.KeepConnection := True;
> ___
> 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] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Reinier Olislagers
On 3-8-2011 11:50, Michael Van Canneyt wrote:
> 
> 
> On Wed, 3 Aug 2011, Reinier Olislagers wrote:
> 
>> When using the Firebird embedded database, it's nice to be able to
>> create the database using only FreePascal/Lazarus.
> 
> Why do you think this is not possible ? The CreateDB method of
> TIBConnection does exactly that.
> 
> I've been using it for years.
> 
> Michael.
Thanks Michael, I had just found that out (see my reply to Tony Whyman).

I've added the information to the Lazarus Firebird tutorial on the wiki.

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


Re: [fpc-pascal] Bump: Trouble setting/getting ftVarBytes field data in TBufDataset

2011-08-03 Thread Marco van de Voort
In our previous episode, Reinier Olislagers said:
> > TObject?
> > 
> 
> Does anybody have a suggestion on how to use ftVarbytes fields or aren't
> they supported in FPC?

Afaik currently mostly ftblob is used for variable binary storage. I'm not
entirely sure what the difference is?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread michael . vancanneyt



On Wed, 3 Aug 2011, Tony Whyman wrote:


Actually, my preference for creating a database in a deployed
application is to first create it on my local system using isql with
input from a  script and then to save it using gbak in a portable
format. The TIBRestoreService is then used to create the database from
the backup archive when your program fails to detect a local database copy.

The advantages of this approach are that:

- you only ever have one file to distribute

- backup/restore is very robust and quick

- you can readily add Blob data to your archive and distribute it as
part of the archive

- the initial database is consistent across all deployments

Scripts tend to be more useful when issuing patches to existing
databases. In this case, simply calling isql from your program and
pointing it at a patch script can be much easier than embedding SQL
execution in your program.


Why ? You need SQL execution anyway. 
If you want to use isql, you must detect where it is installed and whatnot;

You must write code to capture output or check for errors. In SQL execution
you don't need all that - you already have it.

I've used creation and update of database with TSQLScript for years, and
we've thousands of installed databases at client sites. You need the
SQL execution technology anyway, so IMHO there is little point in using 
2 different technologies. 
It means extra coding, and therefor extra room for errors.


As for backup/restore being robust: this is not 100% correct. 
It is extremely easy to create a corrupt backup in firebird.
Just add a required field to any table with data, create the backup. 
This backup cannot be restored.


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


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Reinier Olislagers
On 3-8-2011 12:05, Tony Whyman wrote:
> Actually, my preference for creating a database in a deployed
> application is to first create it on my local system using isql with
> input from a  script and then to save it using gbak in a portable
> format. The TIBRestoreService is then used to create the database from
> the backup archive when your program fails to detect a local database copy.
> 
> The advantages of this approach are that:
> 
> - you only ever have one file to distribute
> 
> - backup/restore is very robust and quick
> 
> - you can readily add Blob data to your archive and distribute it as
> part of the archive
> 
> - the initial database is consistent across all deployments
> 
> Scripts tend to be more useful when issuing patches to existing
> databases. In this case, simply calling isql from your program and
> pointing it at a patch script can be much easier than embedding SQL
> execution in your program.
> 

I understand your approach - and I suspect you have a lot more
experience with Firebird deployments than I.

As for the scripts, yes, I agree that's a good idea for patching, but it
would be nice if you could use SQLDB's SQLScript for that (haven't tried
it yet). This cuts down on the number of external files you have to
distribute.

I needed to create a db in code because I was writing a sample Lazarus
application to show how to use SQLDB with embedded Firebird:
http://lazarus.freepascal.org/index.php/topic,10811.msg74279.html#msg74279

Having people download and run isql just to set up the database seemed
inelegant, error prone and time consuming.
Of course, I could have used IBX components, but then people would have
to download & install those

Thanks for your insights,

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


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Tony Whyman
Michael,

I will concede that backup/restore is vulnerable to rubbish in/rubbish
out errors. But then if you don't test your backup before distribution

On 03/08/11 11:21, michael.vancann...@wisa.be wrote:
>
> As for backup/restore being robust: this is not 100% correct. It is
> extremely easy to create a corrupt backup in firebird.
> Just add a required field to any table with data, create the backup.
> This backup cannot be restored.
>
> 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] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Michael Van Canneyt



On Wed, 3 Aug 2011, Tony Whyman wrote:


Michael,

I will concede that backup/restore is vulnerable to rubbish in/rubbish
out errors. But then if you don't test your backup before distribution


Yes, of course. 
We have checklists and procedures for that when we do updates :-)


I just wanted to say that firebird backups are not guaranteed to be reliable.
It can bite you in the leg quite unexpectedly.

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


RE : [fpc-pascal] Bump: Trouble setting/getting ftVarBytes field data inTBufDataset

2011-08-03 Thread Ludo Brands


> On 2-8-2011 7:39, Reinier Olislagers wrote:
> > I've got trouble finding out how to fill and retrieve data for a 
> > ftVarBytes field in a TBufDataset.
> > 
> > .AsString doesn't seem to work well - if I fill it with the 
> string How 
> > do I fill this field? I get back
> > How
> > 
> > I tried SetData, which takes a buffer as data, so I tried filling a 
> > PChar with the string data. Retrieving it leads to a big dump of 
> > memory, so I wonder how you define the end of the buffer in the 
> > SetData call.
> > 
> > Hope somebody can point me to some documentation or tell me 
> the proper 
> > way to do this. I've looked at Delphi docs, but that dealt 
> mostly with 
> > general BLOB fields, don't know if that includes varBytes.
> > 
> > Below some test code and output:
> > program varbytesproject;
> > 
> > {$mode objfpc}{$H+}
> > {$APPTYPE CONSOLE}
> > 
> > uses
> >   {$IFDEF UNIX}{$IFDEF UseCThreads}
> >   cthreads,
> >   {$ENDIF}{$ENDIF}
> >   Classes, SysUtils,
> >   { you can add units after this }
> >   DB, BufDataSet;
> > 
> > var
> >   TestDataset: TBufDataset;
> >   FieldDef: TFieldDef;
> >   TestString: String;
> >   TempPChar: PChar;
> > begin
> >   TestDataset := TBufDataset.Create(nil);
> >   FieldDef := TestDataset.FieldDefs.AddFieldDef;
> >   FieldDef.Name := 'ftVarBytes';
> >   FieldDef.DataType := ftVarBytes;
> >   FieldDef.Size := 2;
> >   TestDataset.CreateDataSet;
> >   TestDataset.Open;
> >   TestDataset.Append;
> > 
> >   writeln('1. How do I fill an ftVarBytes field?');
> >   Teststring:='How do I fill this field?';
> >   writeln('2. Like this?');
> >   TestDataset.FieldByName('ftVarBytes').Asstring := Teststring;
> >   writeln('ftVarbytes.AsString: ' + 
> > TestDataset.FieldByName('ftVarBytes').AsString);

This is the way to do it. However:
- FieldDef.Size := 2; You only store 2 characters. 
- TCustomBufDataset.GetFieldSize doesn't recognise TBinaryField descendants
and fixes their length arbitrary as 10 bytes... Setting fieldsize to more
than 10 bytes won't store more than 10 chars. TMemDataset handles this more
elegantly by raising a SErrFieldTypeNotSupported.
So the answer is that TBufDataset doesn' support TBinaryField descendants
correctly.

For test purposes, limit field size to 10 bytes ;)

Ludo


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


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Tony Whyman
I understand now what you are doing and would agree that for a simple
demo, you really do want to create the DB in code. I am thinking more
about distributing and supporting a fully supported application.

Interesting that I seemed to get so much push-back when I suggested isql
- I did so as a simple way to distribute a patch (and with an underlying
assumption that you would install a copy in your application directory
in order to avoid searching for it). In practice, I don't use isql to
patch a deployed database but have my own set of units to execute an SQL
Script using the TIBSQL component. I didn't suggest this because this is
more than just executing a script, but also includes version control
tables in the database itself and a configuration file distributed with
the scripts to tell the updating application which scripts have to be
applied to get to a specific patch level and so on. Or to put it another
way, I didn't want to get into a lengthy discussion on how to maintain a
database in the field. Perhaps I should have just avoided the topic :(

On 03/08/11 11:23, Reinier Olislagers wrote:
> I needed to create a db in code because I was writing a sample Lazarus
> application to show how to use SQLDB with embedded Firebird:
> http://lazarus.freepascal.org/index.php/topic,10811.msg74279.html#msg74279
>
> Having people download and run isql just to set up the database seemed
> inelegant, error prone and time consuming.
> Of course, I could have used IBX components, but then people would have
> to download & install those
>
> Thanks for your insights,
>
> Reinier
> ___
> 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] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Michael Van Canneyt



On Wed, 3 Aug 2011, Tony Whyman wrote:


I understand now what you are doing and would agree that for a simple
demo, you really do want to create the DB in code. I am thinking more
about distributing and supporting a fully supported application.

Interesting that I seemed to get so much push-back when I suggested isql
- I did so as a simple way to distribute a patch (and with an underlying
assumption that you would install a copy in your application directory
in order to avoid searching for it). In practice, I don't use isql to
patch a deployed database but have my own set of units to execute an SQL
Script using the TIBSQL component. I didn't suggest this because this is
more than just executing a script, but also includes version control
tables in the database itself and a configuration file distributed with
the scripts to tell the updating application which scripts have to be
applied to get to a specific patch level and so on. Or to put it another
way, I didn't want to get into a lengthy discussion on how to maintain a
database in the field. Perhaps I should have just avoided the topic :(


Funny to see that you actually do (A) and then recommend doing (B).

When in fact, I do (A) almost exactly as you do, and so would expect 
you to recommend (A) as well ?


Practice learns that the so-called 'simple solutions' (B)
over time turn out to be highly insufficient, and you end up doing (A) anyway.

So better recommend (A) from the start :-)

It was not my intention to scare you off, my apologies if it came over as such 
:-/

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


Re: [fpc-pascal] Is there a way to create a Firebird embedded database programmatically?

2011-08-03 Thread Reinier Olislagers
On 3-8-2011 12:38, Tony Whyman wrote:
> I understand now what you are doing and would agree that for a simple
> demo, you really do want to create the DB in code. I am thinking more
> about distributing and supporting a fully supported application.
> 
> Interesting that I seemed to get so much push-back when I suggested isql
> - I did so as a simple way to distribute a patch (and with an underlying
> assumption that you would install a copy in your application directory
> in order to avoid searching for it). In practice, I don't use isql to
> patch a deployed database but have my own set of units to execute an SQL
> Script using the TIBSQL component. I didn't suggest this because this is
> more than just executing a script, but also includes version control
> tables in the database itself and a configuration file distributed with
> the scripts to tell the updating application which scripts have to be
> applied to get to a specific patch level and so on. Or to put it another
> way, I didn't want to get into a lengthy discussion on how to maintain a
> database in the field. Perhaps I should have just avoided the topic :(

Agreed regarding putting isql in the app directory if you're using it;
that way you get to control what you're executing...

I understand what you're doing too - even about version tables and such.
Just never had to do it in Firebird & FPC yet ;)
As for lengthy discussions, it seems this list seems to have a few - but
I'm not in an argumentative mood ;)

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


Re: RE : [fpc-pascal] Bump: Trouble setting/getting ftVarBytes field data inTBufDataset

2011-08-03 Thread Reinier Olislagers
On 3-8-2011 12:32, Ludo Brands wrote:
>> On 2-8-2011 7:39, Reinier Olislagers wrote:
>>> I've got trouble finding out how to fill and retrieve data for a 
>>> ftVarBytes field in a TBufDataset.
>>>   TestDataset.FieldByName('ftVarBytes').Asstring := Teststring;
>>>   writeln('ftVarbytes.AsString: ' + 
>>> TestDataset.FieldByName('ftVarBytes').AsString);
> 
> This is the way to do it. However:
> - FieldDef.Size := 2; You only store 2 characters. 
Oops. Correct.
> - TCustomBufDataset.GetFieldSize doesn't recognise TBinaryField descendants
> and fixes their length arbitrary as 10 bytes... Setting fieldsize to more
> than 10 bytes won't store more than 10 chars. TMemDataset handles this more
> elegantly by raising a SErrFieldTypeNotSupported.
> So the answer is that TBufDataset doesn' support TBinaryField descendants
> correctly.
> 
> For test purposes, limit field size to 10 bytes ;)
Thanks for the answer, I will ;)
(I'll have a go at adding this info to the wiki as well)

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


[fpc-pascal] x86-64 vs x86_64 vs x64

2011-08-03 Thread Graeme Geldenhuys
Hi,

I searched the FPC Programmer's Guide and Users Guide, and nowhere is
there a definitional of description explaining the difference.

So here is to anybody that knows: What is the difference between a
target x86-64, target x86_64 and a target x64?


eg:
Here is the output of my FPC compiler under Ubuntu 10.04 (64-bit) using
FPC 2.4.5 (latest fixes branch).

$ fpc -i
--
Free Pascal Compiler version 2.4.5

Compiler Date  : 2011/07/08
Compiler CPU Target: x86_64

Supported targets:
  Linux for x86-64
  FreeBSD for x86-64
  Win64 for x64
  Darwin for x86_64
  Solaris for x86-64 (under development)
--

There are 3 different 64-bit targets listed, but what is the difference
between them. Is is this just a typo somewhere in the compiler (though I
doubt that).



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/mailman/listinfo/fpc-pascal


[fpc-pascal] Best optimizations for Intel Quad Core CPU

2011-08-03 Thread Graeme Geldenhuys
Hi,

I know when deploying an application, it is always best to be
conservative with the compiler optimization options - thus your
application can run on most CPU's out there (maximum compatibility).

But what is the best optimization options I can specify for my own
system. This includes FPC itself, Lazarus IDE, MSEide, fpGUI DocView,
fpGUI UI Designer etc... all the tools I use on a daily basis.

I find it a waist compiling for 386 CPU compatibility, when there is not
a single person in our office still running a 386 system.

So for a start, I want to optimize the application that run on MY
system. This is the CPU I have in my system:

$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 23
model name  : Intel(R) Core(TM)2 Quad CPUQ9400  @ 2.66GHz
stepping: 10
cpu MHz : 2664.451
cache size  : 3072 KB
physical id : 0
siblings: 4
core id : 0
cpu cores   : 4
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 13
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm
constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64
monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm
tpr_shadow vnmi flexpriority
bogomips: 5328.90
clflush size: 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:



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/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPImage and WebP support

2011-08-03 Thread Graeme Geldenhuys
On 3 August 2011 11:36, Marco van de Voort wrote:
>
> If you look around a bit you see also a lot of criticism. On the results of
> Google's tests, and the incompleteness of the reference implementation.
> ...
> And of course browser support is still seriously lacking.

None the less it is still interesting. Google trying to bring a new
image format into today's times - it will have to be something very
special to beat the likes of JPG, PNG etc.

I wasn't really asking if somebody will implement WebP support in
FPImage, I was just curious if somebody has thought of it. Thanks for
the links though, I'll read those tonight.


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] x86-64 vs x86_64 vs x64

2011-08-03 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> I searched the FPC Programmer's Guide and Users Guide, and nowhere is
> there a definitional of description explaining the difference.
> 
> So here is to anybody that knows: What is the difference between a
> target x86-64, target x86_64 and a target x64?

Afaik

Human readable OSS designation, machine readable OSS designation (for use in
filenames), Microsoft designation.


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


Re: [fpc-pascal] x86-64 vs x86_64 vs x64

2011-08-03 Thread Jonas Maebe


On 03 Aug 2011, at 14:11, Graeme Geldenhuys wrote:


So here is to anybody that knows: What is the difference between a
target x86-64, target x86_64 and a target x64?


None. The target names are simple strings in the compiler/i_*.pas  
files and unrelated to the code generation.



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


Re: [fpc-pascal] FPImage and WebP support

2011-08-03 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> > Google's tests, and the incompleteness of the reference implementation.
> > ...
> > And of course browser support is still seriously lacking.
> 
> None the less it is still interesting. Google trying to bring a new
> image format into today's times - it will have to be something very
> special to beat the likes of JPG, PNG etc.

This is a repetition of earlier arguments in favour of jpeg2000. 

We'll see how it progresses. Note that I'm not really negative, it is just
more that I consider it to early along (too little 3rd party support,
no undisputed reference lib) to invest major time in it.

But maybe there is sb with too much time and a special interest.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] FreeVision usable in a client/server database application?

2011-08-03 Thread Reinier Olislagers
Hi list,

I'm looking into converting a half-finished small timekeeping/billing
application of mine from .Net to Lazarus/Freepascal. It runs on SQL
Server 2008.

I'm thinking about trying to separate out the database layer (using
something like tiOPF perhaps) from the presentation layer.

I could then write a Lazarus GUI to deal with the data.
(Not even mentioning web interfaces for now, too much to learn ;)

While I'm doing that, I thought about using character mode terminals
(DOS or Linux shell) for quick data entry. I've once looked at
FreeVision (about 10 years ago), but was even more of a
Pascal/programming newbie than now, so couldn't get it to work.

Is it worth looking into FreeVision or could I better forget about it?
If so, I suppose the old FreePascal IDE would be a good example to study?


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


Re: [fpc-pascal] web app and application persistency

2011-08-03 Thread Marcos Douglas
On Tue, Aug 2, 2011 at 6:51 PM, Graeme Geldenhuys
 wrote:
> On 1 August 2011 16:32, Michael Van Canneyt wrote:
>>
>> If you really want the application running 100% of the time, there are only
>> 2 options:
>> - fastcgi with mod_fastcgi (NOT mod_fcgid) and ExternalFastCGIServer option.
>> - Embedded server (i;e. the application acts as a webserver).
>
> ...and option 3.
> Application on the server (as a daemon or service or something), and
> the CGI app is simply acting as a proxy. I did test this in a small
> test case and it worked well - no idea how well it will scale though.
>
> But the other two options are probably easier to program.

It's call _CGI gateway_ and I think this is a good option because you
can redirect the CGI to another app/server/information when you stop
the app service on the server.

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


Re: [fpc-pascal] web app and application persistency

2011-08-03 Thread Jorge Aldo G. de F. Junior
You can use L7 filtering to select actions based on packet content.

2011/8/1 Andrew Brunner :
> The only thing I can think of would be packet inspection.  Firewalls
> included with Linux and Windows do not perform "deep" packet
> inspection.  They only allow/deny packets with specific ports over
> either TCP or UDP.
>
> Am I missing something?
>
> On Mon, Aug 1, 2011 at 12:31 PM, Michael Van Canneyt
>  wrote:
>> Any reason why it should not detect it ?
> ___
> 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] web app and application persistency

2011-08-03 Thread Marco van de Voort
In our previous episode, Andrew Brunner said:
> The only thing I can think of would be packet inspection.  Firewalls
> included with Linux and Windows do not perform "deep" packet
> inspection.  They only allow/deny packets with specific ports over
> either TCP or UDP.

Usually they deny all ports by default and route 80, 8080 and 443 to a
proxy, which *does* understand http.

It might be that websockets are too much like normal http requests that a
proxy will put them through, but I'd check that before betting  on
websockets.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FreeVision usable in a client/server database application?

2011-08-03 Thread Michael Van Canneyt



On Wed, 3 Aug 2011, Reinier Olislagers wrote:


Hi list,

I'm looking into converting a half-finished small timekeeping/billing
application of mine from .Net to Lazarus/Freepascal. It runs on SQL
Server 2008.

I'm thinking about trying to separate out the database layer (using
something like tiOPF perhaps) from the presentation layer.

I could then write a Lazarus GUI to deal with the data.
(Not even mentioning web interfaces for now, too much to learn ;)

While I'm doing that, I thought about using character mode terminals
(DOS or Linux shell) for quick data entry. I've once looked at
FreeVision (about 10 years ago), but was even more of a
Pascal/programming newbie than now, so couldn't get it to work.

Is it worth looking into FreeVision or could I better forget about it?
If so, I suppose the old FreePascal IDE would be a good example to study?


It should definitely work.

Whether it's recommended is another matter. I don't think so. 
You'd be better of with a web interface then.


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