#101 Re: mORMot 1 » Update clients GUI » 2014-01-11 22:03:18

I just use UpdateFromServer on my clients but I get some "blocking" problem.
My clients have some grids. For any grid I use a TSQLTableJSON to retrive data from some tables, then I use UpdateFromServer to know if there a update data.
My problem is this if UpdateFromServer I must retrive a now TSQLTableJSON with ALL to update the client grid.
Also if there only a update record of TSQLTableJSON I don't know it so I must retrive ALL in this way I have a "blocking" problem (for 3-4 seconds).

#102 mORMot 1 » Update clients GUI » 2014-01-10 23:52:39

array81
Replies: 3

My application use a server-clients systems, so I have a server application and many clients applications.
The clients can edit database table so I have added a procedure to update te GUI all other clients with a client edit the database.

What is the best way to do it? I need a fast and no-blocking system.
I think the best way is allow to server send the new record to all the clients when there are some update but I don't know if this is possible.
I'm not an expert of server-clients systems so I'd like know what is the best way to do it.

Thanks

#103 Re: PDF Engine » Advice for the use of PDF Engine » 2013-05-17 12:32:41

Is there a way to do this:
1. create a PDF with many pages;
2. the pages can have differente size (ex. A4, A3 or custom size);
3. the pdf must have high resolution (ex. 300 dpi), because I must stamp big bitmap on page.

#104 Re: PDF Engine » Advice for the use of PDF Engine » 2013-05-16 15:33:02

Yes, I know, I have try to comment them but I get always a big page: about 87 cm x 123 cm...

#105 Re: PDF Engine » Advice for the use of PDF Engine » 2013-05-16 14:42:51

If I set DefaultPageWidth/Heigh I get the same result.

      dpi := 300;
      lPdf.DefaultPageWidth := Round(dpi * 210 / 25.4);
      lPdf.DefaultPageHeight := Round(dpi * 297 / 25.4);
      lPdf.DefaultPaperSize := psUserDefined;
      lPdf.PDFA1 := True;
      lPdf.ScreenLogPixels:=dpi;
      lPage := lPDF.AddPage;
      lPage.PageWidth := Round(dpi * 210 / 25.4);
      lPage.PageHeight := Round(dpi * 297 / 25.4);

#106 Re: PDF Engine » Advice for the use of PDF Engine » 2013-05-16 13:49:02

Because in my example I have used an A4 pages but general I don't know the page size until extract the image from my original PDF (no PDF/A-1), so I need use 2 variables to set Width and Height.
Something like:

      dpi := 300;
      lPdf.DefaultPaperSize := psUserDefined;
      lPdf.PDFA1 := True;
      lPdf.ScreenLogPixels:=dpi;
      lPage := lPDF.AddPage;
      lPage.PageWidth := Round(dpi * pWidth / 25.4);
      lPage.PageHeight := Round(dpi * pHeight / 25.4);

Any idea?

#107 Re: PDF Engine » Advice for the use of PDF Engine » 2013-05-16 09:32:41

Thank you for your reply.
I have write a small piece of code but I have a problem because I don't understand how can I handle the image resolution.
I have extract 2 bitmap from my PDF: 1 bitmap from A4 page with 300 dpi and 1 bitmap from A3 page with 300 dpi;
Now I need create a PDF/A-1 with 2 pages (A4 + A3) but I cannot lost information about resolution. How can I set the page?
This is a piace of my code:

      dpi := 300;
      lPdf.DefaultPaperSize := psUserDefined;
      lPdf.PDFA1 := True;
      lPdf.ScreenLogPixels:=dpi;
      lPage := lPDF.AddPage;
      lPage.PageWidth := Round(dpi * 210 / 25.4);
      lPage.PageHeight := Round(dpi * 297 / 25.4);

If I use dpi=72 (screen resolution) I get a PDF with A4 page (21cm x 29,7 cm) but if I set dpi=300 I get a big page.
I don't understand how cannot lost the resolution of my origin image.

#108 PDF Engine » Advice for the use of PDF Engine » 2013-04-22 12:36:52

array81
Replies: 9

I need of advice to understand if I can use your PDF Engine on my project.
In my project I use an external library to extract PDF page as image (with 200/300 dpi).
Now I need convert a PDF to PDF/A-1. I know your library cannot read a PDF but it can write a PDF/A-1, so I think I can extract all page of my PDF as bitmap then use your library to generate a PDF/A-1 with an image for page.

Questions:
1. Is it possible with your PDF Engine?
2. My image are big (200/300 dpi) but the PDF page are simple: text, tables and some small image so I cannot need of a perfect copy of it. Is there a way to reduce the PDF/A-1 size?
3. Do you think this is a good (not best) solution? I have PDF with 5/20 pages, the PDF/A-1 will take many time?

regards

#109 Re: mORMot 1 » Is exists any tutorial video about mORMot? » 2013-03-29 16:20:46

CamStudio is freeware and opensource. It's not perfect but can be a good solution: http://sourceforge.net/projects/camstudio/

#110 Re: mORMot 1 » SQLite3 performance: .obj vs .dll » 2013-02-27 11:45:44

But if I use the DLL library from wxsqlite instead of OBJ, how can use my encrypted database. Must I change my code? How?
What version of sqlite is based this "AES" library? I cannot find details.

#111 GDI+ » Draw semitransparent polygons » 2013-02-26 14:09:56

array81
Replies: 2

Hi,

I have a TBitmap or a TCanvas with a picture. Now I need add some semitransparent polygons with different color over picture.
I think this is possible with GDI+ but I cannot get information about it.

Is it possible get a piace of code about it?

Thanks

#112 Re: mORMot 1 » Connect with MDB database in NOT exclusive mode » 2013-02-09 23:37:18

I don't change the db right, and the first application that I run can access without problem, so I don't think it is a access right problem.

#113 mORMot 1 » Connect with MDB database in NOT exclusive mode » 2013-02-09 11:01:26

array81
Replies: 2

Hi,

I have a software that use MDB (access) database to save the data.
In my application I use TOleDBConnectionProperties to connect with this DB and read/write some data.

However I have a small problem. I cannot run the software together, in fact if I try to run the applications together I get an error from the application that I started to second because the DB is block.

Is there a way to avaoid it? My application is similar to other software that allow it without problem, so I think this is possible but i don't know how.

regards

#114 mORMot 1 » FieldsName properties not found » 2012-11-10 09:41:23

array81
Replies: 1

On my application I use this code:

          for b := 0 to Length(ContactsRecords.RecordProps.FieldsName) - 1 do
            begin
              var1 := StringReplace(var1, '[' + ContactsRecords.RecordProps.FieldsName[b] + ']', UTF8ToString(ContactsRecords.GetFieldValue(ContactsRecords.RecordProps.FieldsName[b])), [rfReplaceAll, rfIgnoreCase]);
              var2 := StringReplace(var2, '[' + ContactsRecords.RecordProps.FieldsName[b] + ']', UTF8ToString(ContactsRecords.GetFieldValue(ContactsRecords.RecordProps.FieldsName[b])), [rfReplaceAll, rfIgnoreCase]);
              var3 := StringReplace(var3, '[' + ContactsRecords.RecordProps.FieldsName[b] + ']', UTF8ToString(ContactsRecords.GetFieldValue(ContactsRecords.RecordProps.FieldsName[b])), [rfReplaceAll, rfIgnoreCase]);
            end;

On last version of your framework TSQLRecordProperties.FieldsName is remove, why?
How can I replace my code?

#115 Re: mORMot 1 » Save and load PNG image » 2012-11-07 14:09:15

in fact. for the moment I have convert my png to bitmap 32bit so can avoid the problem. I hope this bug will be fixed

#116 Re: mORMot 1 » XE3 and FMX » 2012-11-07 08:56:24

I use it on XE3 without problem.

#117 Re: mORMot 1 » Save and load PNG image » 2012-11-06 09:01:49

Good, so it's there a bug or a problem with last version of Delphi...
On old version it's works (I have tested only on Delphi 2006).

#118 Re: mORMot 1 » Speed problem » 2012-11-02 11:52:56

OK.

1. Is there a way to use SQL (for example call "VACUUM") with TSQLRest? Or si it right use TSQLRestServerDB.
2. "use a transaction (and a batch process)" but for this I need of TSQLRestClientDB and then of TSQLRestServerDB, right?

#119 Re: mORMot 1 » Speed problem » 2012-11-01 23:14:52

OK, I have read the article.

But:
1) TSQLRestServerDB doesn't have a Synchronous property, where I find it?
2) I need use TSQLRestClientDB e TSQLRestServerDB also if I use a local database?

#120 Re: mORMot 1 » Save and load PNG image » 2012-11-01 22:16:30

Can someone test my demo on XE3?

#121 mORMot 1 » Speed problem » 2012-11-01 22:15:21

array81
Replies: 5

I must add about 250000 record on a SQLite table. My code works but it's very slow.

MyRecord := TSQLMyTable.Create;
try
  MyRecord .AAA:= StringToUTF8('test');
  MyRecord .BBB := StringToUTF8('test');
  MyRecord .CCC := StringToUTF8('test');

  if Database.Add(TAFRecord, True) > 0 then
    begin

    end;
finally
  TAFRecord.Free;
end;

I'm working on local computer (no client/server) and I use "Database: TSQLRestServerDB;" (I cannot use "Database: TSQLRest;" because I need EngineExecuteAll to run "VACUUM" sql).

Can you help me?

#122 Re: mORMot 1 » Save and load PNG image » 2012-10-22 20:56:28

With Delphi XE3?

Please see the small demo: http://dl.dropbox.com/u/19900180/pngproblem.zip

The code is very simple:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, SynGdiPlus, Vcl.Imaging.pngimage,
  Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

initialization
  Gdip.RegisterPictures;

end.

There is only a form with a PNG, on design time I can see the PNG but on run time I cannot see it (see the exe demo).

I don't understand...

Do you have some ideas?

PS with Delphi 2006 I don't have this problem.

#123 Re: mORMot 1 » Save and load PNG image » 2012-10-22 16:25:48

Are there other users with the same problem? I cannot use PNG any more...

#124 Re: mORMot 1 » Save and load PNG image » 2012-09-23 12:24:30

I have a small problem.
Today I have convert my application from Delphi 2006 to Delphi XE3.
All the code works without problem but I have a small bug, I need to use

initialization
  Gdip.RegisterPictures;

to use the code above (save/load image from/to database) but with this code at runtime all my TImage with PNG image are black, if I comment this code I can see all PNG on my TImage but I cannot save/load image from/to database.

How can I solve it?
Thanks

#125 mORMot 1 » Save and load PNG image » 2012-09-20 13:30:31

array81
Replies: 10

Hi,

I need save a PNG (with transparent) on a field of my database and the load it to show on my form.

I think I can use the code write for bitmap:

SAVE:

var
  doc: RawByteString;
begin
  SaveAsRawByteString(imgDocument.Picture,doc,gptPNG,80,1500);
  Database.UpdateBlob(TSQLContacts, Contact.ID, 'Document', doc); 
end;

my problem is the code to LOAD the image, now in fact I use:

var
  doc: TSQLRawBlob;
  pic: TBitmap;
begin
   Database.RetrieveBlob(TSQLContacts, Contact.ID, 'Document', doc);
   Contact.Document := doc;

   pic := PictureToBitmap(ContattoRecord.Document);

   if pic <> nil then
     begin
        image.Picture.Bitmap.Assign(pic);
        pic.Free;
     end;
end;

Where PictureToBitmap is:

function PictureToBitmap(const Picture: RawByteString): TBitmap;
var
  ST: THeapMemoryStream;
begin
  Result := nil;
  if Picture='' then
    exit;
  ST := THeapMemoryStream.Create;
  try
    ST.Write(pointer(Picture)^,length(Picture));
    with TSynPicture.Create do
    try
      LoadFromStream(ST);
      result := ToBitmap;
    finally
      Free;
    end;
  finally
    ST.Free;
  end;
end;

Is there a way to get a PNG and not a BMP? In PictureToBitmap there is ToBitmap to get a bitmap, but for other images format?

#126 Re: mORMot 1 » Unicode problem » 2012-09-17 14:30:14

OK, it's possible add a IMPORT feature into SynDBExplorer to import from csv file. So I can avoid to use external SQLite editor.

#127 Re: mORMot 1 » Unicode problem » 2012-09-16 21:54:24

Titolo is RawUTF8:

  TSQLMyRecord = class(TSQLRecord)
  private
    fTitolo: RawUTF8;
  published
    property Titolo: RawUTF8 read fTitolo write fTitolo;
  end;

I have create the databse by framework (so I think the data type is correct), then I have popolate the database by an external editor (http://sqliteadmin.orbmu2k.de/).

I just to it the same things when I have develop another application without problem, ...

#128 mORMot 1 » Unicode problem » 2012-09-16 09:00:30

array81
Replies: 4

Hi,

I'm not follow the last change on your frameworks.
I have start a new application develop with Delphi 2006 and I have update the frameworks with last build.
I have a strange problem: if I use UTF8ToString() the result string doesn't have some char like à, ò, ù, ...

For example:

  MyRecord := TSQLMyRecord.CreateAndFillPrepare(Database, '');
  try
    while MyRecord.FillOne do
      begin
        if MyRecord.ID <> 0 then
          begin
            MessageDlg(MyRecord.Titolo,mtError, [mbOK], 0); // GET RIGHT STRING TEXT: "qualità"
            MessageDlg(UTF8ToString(MyRecord.Titolo),mtError, [mbOK], 0); // GET BAD STRING TEXT: "qualit"
          end;
      end;
  finally
    MyRecord.Free;
  end;

Do you have change somethings on your framework? Any ideas?

#129 Re: GDI+ » Draw image and save as tiff » 2012-08-23 17:21:53

I will check gdiplus.dll and the I will report the result.

I need to create a TIFF from a BMP with 200dpi and evCompressionCCITT4, do you know other delphi class or small library for this?

#130 Re: GDI+ » Draw image and save as tiff » 2012-08-23 14:48:07

My searches have not led to anything.
I have download Windows Imaging Component but when I try to install it I get an error because the last version is just installed on my Windows XP.
I have also copy gdipluss.dll library on my application path, but also this not work.

I don't have an error, only a TIFF file empty...

Other ideas about it?

#131 Re: GDI+ » Draw image and save as tiff » 2012-08-21 19:05:10

I don't understand the minimum to use the SynGDIPlus.
I have tested my code on Windows 7 without problem, but on Windows XP I get a TIF image of 0 kb...

Which OS I need? Is there a way to extend the use?

#132 Re: GDI+ » Draw image and save as tiff » 2012-08-11 12:56:03

I have solved using ord(evCompressionCCITT4) on SynGDIPlus.SaveAs.
Thanks

#133 Re: GDI+ » Draw image and save as tiff » 2012-08-02 22:41:06

Many thanks.

Other question smile

Is there a way to set color depth? I need of a tiff with 1bit of color (only black and with, no gray scale). Is it possible?

Thanks again.

#134 Re: GDI+ » Draw image and save as tiff » 2012-07-30 17:25:33

I have check the code. I think in this moment is not possible set DPI.
Is it possible add this feature?

#135 Re: GDI+ » Draw image and save as tiff » 2012-07-25 20:32:47

OK.

For example I want create a 10x11 inch image with 100 dpi.

I can use:

var Bmp: TBitmap;
    MF: TMetaFile;
    MetafileCanvas: TMetafileCanvas;
begin
  Gdip := TGDIPlusFull.Create('gdiplus.dll');
  MF := TMetaFile.Create;

  MF.Width := 1000;
  MF.Height := 1100;

  MetafileCanvas := TMetafileCanvas.Create(MF, 0);
  MetafileCanvas.Brush.Color := clRed;
  MetafileCanvas.Brush.Style := bsDiagCross;
  MetafileCanvas.Ellipse(50, 50, 300 - 50, 200 - 50);
  MetafileCanvas.Free;

  Bmp := Gdip.DrawAntiAliased(MF);

  Image1.Picture.Assign(Bmp);
  SynGDIPlus.SaveAs(Bmp, 'c:\test.tif', gptTIF); 
  Bmp.Free;

  MF.Free;
  FreeAndNil(GdiP);
end;

In this way the TIFF have always 96 DPI (screen resolution). How can I change it?

Thanks

#136 GDI+ » Draw image and save as tiff » 2012-07-23 14:31:45

array81
Replies: 17

I need some advice.

I have develop a small component that use a TPaintBox, I use the TPainBox to draw on canvas some objects (line, point, circle, ...).

Now I need save my canvas as a TIFF with specific size and resolution (200 dpi) if possible with antialiased.

I'd like know if and how can I do it with your framework. Is it possible? It there a piace of code about it? Which is the more easy way to not rewrite all my code?

Thanks

#137 Re: mORMot 1 » Windows Firewall Ports » 2012-07-09 20:16:19

OK I think I have found the problem.
This code works:

procedure AddPortTo7Firewall(const EntryName: string; PortNumber: cardinal);
var
  fwMgr, profile, NewRule, RulesObject: OleVariant;
begin
  fwMgr := CreateOleObject('HNetCfg.FwPolicy2');
  profile := NET_FW_PROFILE2_PRIVATE OR NET_FW_PROFILE2_PUBLIC;

  try
    RulesObject         := fwMgr.Rules;
    NewRule             := CreateOleObject('HNetCfg.FWRule');
    try
      NewRule.Name        := EntryName;
      NewRule.Description := EntryName;
      NewRule.Protocol := NET_FW_IP_PROTOCOL_TCP;
      NewRule.LocalPorts := PortNumber;
      NewRule.Enabled := TRUE;
      NewRule.Profiles := Profile;
      NewRule.Action := NET_FW_ACTION_ALLOW;
      RulesObject.Add(NewRule);
    finally
      NewRule := varNull;
      RulesObject := varNull;
    end;
  finally
    profile := varNull;
    fwMgr := varNull;
  end;
end;

NOTE: set NewRule.Protocol before NewRule.LocalPorts.

Thanks again.

#138 Re: mORMot 1 » Windows Firewall Ports » 2012-07-09 13:02:40

I have try it but I get an error on IntToStr(PortNumber); "Parameter is not correct.".

I don't understand why...

#139 Re: mORMot 1 » Windows Firewall Ports » 2012-07-09 07:39:58

If I remember correctly I have tried to use an string without success. I'll try again (in this moment I'm not in my office) and I'll let you know.

#140 Re: mORMot 1 » Windows Firewall Ports » 2012-07-08 13:56:14

Yes, I just see it and AddExceptionToFirewall (of stackoverflow) works well, but with it I can only add application not port. I need open a port.

Any ideas?

#141 Re: mORMot 1 » Windows Firewall Ports » 2012-07-08 10:56:46

I wrote this code:

procedure AddPortTo7Firewall(const EntryName: string; PortNumber: cardinal);
var
  fwMgr, profile, NewRule, RulesObject: OleVariant;
begin
  fwMgr := CreateOleObject('HNetCfg.FwPolicy2');
  profile := NET_FW_PROFILE2_PRIVATE OR NET_FW_PROFILE2_PUBLIC;

  try
    RulesObject         := fwMgr.Rules;
    NewRule             := CreateOleObject('HNetCfg.FWRule');
    try
      NewRule.Name        := EntryName;
      NewRule.Description := EntryName;
      NewRule.LocalPorts := PortNumber;
      NewRule.Protocol := NET_FW_IP_PROTOCOL_TCP;
      NewRule.Enabled := TRUE;
      NewRule.Profiles := Profile;
      NewRule.Action := NET_FW_ACTION_ALLOW;
      RulesObject.Add(NewRule);
    finally
      NewRule := varNull;
      RulesObject := varNull;
    end;
  finally
    profile := varNull;
    fwMgr := varNull;
  end;
end;

I think this is the right way but I get an error on NewRule.LocalPorts, and I don't understand why, Any ideas?

#142 Re: mORMot 1 » Windows Firewall Ports » 2012-07-07 22:40:04

This is OK, but AddPortToXPFirewall  doesn't work on Windows 7 (as administrator), I need fix it to run as administrator not as user.

#143 mORMot 1 » Windows Firewall Ports » 2012-07-07 16:43:39

array81
Replies: 12

On SQLite3UI.pas I have found these procedures:

procedure AddApplicationToXPFirewall(const EntryName, ApplicationPathAndExe: string);
procedure AddPortToXPFirewall(const EntryName: string; PortNumber: cardinal);

I need use them on my application to change firewall settings. I just have fix AddApplicationToXPFirewall to works also with Private profile (in this moment in fact it works only with Public profile - on Windows 7).

Now I need use AddPortToXPFirewall on Windows 7 but I don't know how I need edit it. In fact in this moment it doesn't work.
I need of AddPortToXPFirewall to open 2 ports by my application (both on Private and Pubblic profiles).

Thanks

#144 Re: mORMot 1 » SynDBExplorer use » 2012-06-11 22:04:43

I don't understand if I have found a bug.
TSQLDBStatement.TotalRowsRetrieved return always 0 until I call TSQLDBStatement.Step, how can I know the row number?

#145 Re: mORMot 1 » SynDBExplorer use » 2012-06-11 14:01:28

ab wrote:

Did you try setting the User (Admin?) + Password fields?

I think the Jet syntax is not the OleDB standard.
Need to fix it.

Yes.

So I need use "Generc OLEDB", right?

#146 Re: mORMot 1 » SynDBExplorer use » 2012-06-11 07:26:12

And where I set the password? I have try to set on password field but it doesn't work.

#147 Re: mORMot 1 » SynDBExplorer use » 2012-06-10 22:25:52

Thanks.

A question Can I use "Jet - mdb OLEDB" with a database protected by password? (see ADO like connect string of first post).

#148 Re: mORMot 1 » SynDBExplorer use » 2012-06-08 18:07:34

Thank you. I will wait for it.

#149 Re: mORMot 1 » SynDBExplorer use » 2012-06-08 16:53:57

I think the problem is Props.GetTableNames(C.fTableNames); of SynDBExplorer.
I hope this can help you.

#150 Re: mORMot 1 » SynDBExplorer use » 2012-06-08 15:14:52

I think on "at connection opening" because I get the error after click on "OK" button of "OLEDB connection box". I hope I have understand your question.
I get error on OleDBCheck procedure.

Board footer

Powered by FluxBB