Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 97,492
» Latest member: jimkuy402
» Forum threads: 2,426
» Forum posts: 11,371

Full Statistics

Online Users
There are currently 1167 online users.
» 4 Member(s) | 1160 Guest(s)
Applebot, Bing, Google, go99kio1, jimkuy402, meeforgartthros1983, Vinmedianl

Latest Threads
WebApplication.IP change ...
Forum: IntraWeb General Discussion
Last Post: MJS@mjs.us
Yesterday, 09:49 PM
» Replies: 1
» Views: 117
Hook/callback to handle t...
Forum: IntraWeb General Discussion
Last Post: Lenfors
09-08-2026, 09:03 AM
» Replies: 0
» Views: 114
Reproducible IIS crash in...
Forum: IntraWeb General Discussion
Last Post: alex.trejo@tttnet.com.mx
09-08-2026, 01:48 AM
» Replies: 0
» Views: 125
The packages IW16.xx inc...
Forum: IntraWeb General Discussion
Last Post: hsbelli
09-03-2026, 11:46 AM
» Replies: 2
» Views: 413
Redirection issues with F...
Forum: IntraWeb General Discussion
Last Post: magosk
08-31-2026, 10:03 AM
» Replies: 0
» Views: 208
Source Code
Forum: IntraWeb General Discussion
Last Post: magosk
08-31-2026, 08:11 AM
» Replies: 3
» Views: 578
TContenthandler requires ...
Forum: IntraWeb General Discussion
Last Post: valmeras
08-30-2026, 02:35 AM
» Replies: 0
» Views: 200
TIWjQDBGrid erratic behav...
Forum: IntraWeb General Discussion
Last Post: alex.trejo@tttnet.com.mx
08-20-2026, 05:12 PM
» Replies: 8
» Views: 2,154
Change Language DataTable
Forum: IntraWeb General Discussion
Last Post: Rigoberto Mercedes
08-19-2026, 03:21 PM
» Replies: 1
» Views: 333
How to terminate HTTP Thr...
Forum: Indy
Last Post: rlebeau
08-14-2026, 08:01 AM
» Replies: 5
» Views: 939

 
  PosEX dosn't work on 64-bit
Posted by: mondoedp - 11-30-2023, 11:20 AM - Forum: IntraWeb General Discussion - Replies (9)

Hello,
I'm just trying new 15.5.2 version that resolved some issues.
I use Delphi 10.2 Tokyo.

Going forward on my tests, I noticed that, when I compile in 64-bit platform, the function StrUtils.PosEx doesnt'work properly.
(I don't call it directly, but it's used (for example) in System.IOUtils (TPath, TDirectory, TFile)).

By example:
PosEx(':','C:\SVN\Mydirectory',3) return 2 (that is the right value if I call PosEx(':','C:\SVN\Mydirectory',1))
while it must return 0 (as 32-bit does).
Also notes that in a normal vcl application (no-intraweb) it works in 64-bit too.

Perhaps it depends by some directive but I wasn't able to find it.

Could you have a check?
Thanks
Alberto Pilat

Print this item

  Add attribute to <html> or <body> tag
Posted by: RenSword - 11-30-2023, 04:01 AM - Forum: IntraWeb General Discussion - No Replies

Is is possible to add attribute to <html> or <body> tag? and change it at runtime
For example
IWForm1.AddAttribute('data-mode="edit"');
>>>>
<html data-mode="edit"> or <body data-mode="edit">

Print this item

  About Indy 10 TIdTCPServer and ramdom disconections
Posted by: PabloRomero - 11-29-2023, 05:24 PM - Forum: Indy - Replies (2)

Dear Indy People.

I have a serious problem and I can't find any information.

I have a service made with Delphi and Indy 10. I made it with TIdTCPServer.

It's a service that controls licenses with a "keep alive". Everything is based using the TIdTCPClient that runs the applications, exchanging information with the server service.

They always exchange XML based structures, like text. In this XML, there is a "command" property. This property receives every 15 minutes the command
"Keep" and the server answers "ok, here I am, Keep ok" and gives to the station that runs my application, status and login information.

All the information is stored in memory in a structure based on Tlist<Types>.

We know that there are threads that are executed in the TidTCPExecute event for each connection.

In my services there are another parallel threads inside the service, to maintain it, renew licenses and clean up unused licenses.

Everything accesses structures based on that Tlist<Lot of Types>. There are of course, other data sharewd by all those threads.

Everything works ok.

But...

Here comes the problem. My application disconnects randomly, to some workstations. I suspect it must be because of the way I protect the structures and data shared by the threads.

Going in detail

We have the IdTCPServerExecute event

Code:
var
    ClientIPAddr: string;

begin
      if not Server.Active then
        exit;

      ClientIPAddr := AContext.Binding.PeerIP;    //ip
      xComando.Linea := fxLeerLinea; //read the line
      if xComando.Linea = '' then 
      begin
        LimpiamosBuffer(AContext); //clean up buffer
        exit;
      end;

      xComando.EsXML := fxEsXML( xComando.Linea ); //is an xml what is coming

      if xComando.EsXML then
        TManejoPaquetesDOM.Procesa( xComando.Linea, Acontext, Server ) //process de estructure and comand. See below
      else
      begin
        TumbarIP(ClientIPAddr);    //clean the connection
        exit;
      end;
      xComando.Linea := ''; //clean line
end;


The "TManejoPaquetesDOM.Procesa( xComando.Linea, Acontext, Server )" is a class like this


Code:
  TManejoPaquetesDOM = class(TIdSync)
  protected
    fLinea: string;
    FContexto: TIdContext;
    FServer  : TIdTCPServer;
    FDespacho: IXMLPaqueteType;

    function  TomaObjXML( linea: string ): IXMLPaqueteType;
    function  fxComandoSoportado( const sComando: string ): boolean;
    procedure EnviaXML;
    procedure AltaEstacion;
    procedure EnvioModulos;
    procedure KeepAlive;
    procedure Informe;
    procedure LLSNoDisponible( pMantenimiento: boolean = false );
    procedure LoginEstacion;
    procedure LimpiaPaquete;
    procedure prExitSesion( pAccion: TManejoSesion; msg : string = '' );
    procedure DoSynchronize; override;

  public
    constructor Crear(linea: string; AContext: TIdContext; pServer: TidTCPServer );
    class procedure Procesa(Linea: string; AContext: TIdContext; pServer: TidTCPServer );
  end;

The "DoSynchronize" does all the work with each connection receive from clients.


Code:
class procedure TManejoPaquetesDOM.Procesa(Linea: string; AContext: TIdContext; pServer: TidTCPServer );
// with this class procedure we manage the thread
begin
    with Crear(linea, AContext, pServer ) do
    try
      Synchronize;
    finally
      Free;
    end;
end;

//the constructor creates, passes the data and parses the XML that brings each station
constructor TManejoPaquetesDOM.Crear(linea: string; AContext: TIdContext; pServer: TIdTCPServer );
begin
    inherited Create;
    fLinea    := linea;

    FContexto  := AContext;
    FContexto.Connection.IOHandler.DefStringEncoding := IndyTextEncoding_UTF8;

    FServer    := pServer;
    FDespacho  := TomaObjXML( linea );
end;


As you can see, "TManejoPaquetesDOM = class(TIdSync)". This is who processes everything. As I understand it, TidSync makes all the other threads
of IdTCPServerExecute threads wait for it to finish.

I'm not sure if this is the best approach, ideally the process should be parallel without making anyone wait.

All the structures when accessed by the other threads of my application are protected with a generic class I made
like this


Code:
  TControlBloqueos = class
  private
    FLlave: TCriticalSection;
  public

    constructor Create;
    destructor Destroy; override;

    procedure Lock;
    procedure Unlock;
  end;

implementation

constructor TControlBloqueos.Create;
begin
  inherited;
  FLlave := TCriticalSection.Create;
end;

destructor TControlBloqueos.Destroy;
begin
  Fllave.Free;
  inherited;
end;

procedure TControlBloqueos.Unlock;
begin
  Fllave.Leave;
end;

procedure TControlBloqueos.Lock;
begin
  Fllave.Enter;
end;

Each time the data shared by threads are accessed, those threads protect the data with an instance of this class, global to the whole service.

This instance is created at the start of the service

Code:
Bloqueo :=  TControlBloqueos.Create;


and all the threads accessing the data, proceed like this.


Code:
Bloqueo.lock;
try
    //process shared data between threads
finally
    Bloqueo.unlock;
end;


My problem is that I can't detect those random disconnections of some users from my system.

My questions

a) Is there a way to speed up what IdTCPServerExecute does? Not using TidSync?

b) What is the best way to protect shared data between threads? I'm not sure what I did is the best approach.

Regards
Pablo Romero

Print this item

  IntraWeb training courses
Posted by: KUD1990 - 11-29-2023, 03:08 PM - Forum: IntraWeb General Discussion - No Replies

Hello everyone, 

can you tell me please if you can recommend me some courses for IntraWeb. On german language will be better because my english ist not to good. 

Thank you and have a nice day


Kind regards

Print this item

  IWSessionTimeout page not show on IIS when session timeout
Posted by: baxing - 11-29-2023, 02:37 PM - Forum: IntraWeb General Discussion - Replies (1)

Hi,

I use timeout template file(IWSessionTimeout.html) in my Templates folder. I test on my local computer by myapp.exe (indy), It show timeout page normally. But I built to myapp.dll and used on my server by IIS. When Timeout occurs, it doesn't show the timeout page, but shows Server Error : 500 - Internal server error instead (There is a problem with the resource you are looking for, and it cannot be displayed.).

I don't know if for ISAPI there needs to be any additional adjustments or not in order to display the Timeout template page when a Timeout occurs because for Indy it displays normally.

Guide me please.

Thank you.

Print this item

  Lazarus IMAP i got error
Posted by: eldonfsr - 11-28-2023, 05:31 PM - Forum: Indy - Replies (1)

Hello i tried to read email with idimap indy on lazarus but i get this error..
 
unable to execute command  wrong connection state, current connection state authenticated 

procedure TFormMain.getunreademails(Sender: TObject);
Var  lj,i,id,attachs:Integer;
    CurrUId:String;
    msg: TIdMessage;
    BodyTexts: TStringList;
    lParts:TIdImapMessageParts;
    SearchInfo: array of TIdIMAP4SearchRec;
begin
//  if( IdIMAP.Connected=false) then begin
//    IdIMAP.Disconnect();
//    sleep(200);
//    IdIMAP.Connect();
//    FolderList:= TStringList.Create;
//    IdIMAP.StatusMailBox('Inbox', IdIMAP.MailBox);
//    IdImap.ListMailBoxes(FolderList);
//    IdImap.SelectMailBox('Inbox');
//  end;

  if(IDIMAP.Connected=false) then begin;
    SetLength(SearchInfo, 1);
    SearchInfo[0].SearchKey := skUnseen;
    IDIMAP.UIDSearchMailBox(SearchInfo);
  end else begin
    SetLength(SearchInfo, 1);
    SearchInfo[0].SearchKey := skUnseen;
    IDIMAP.UIDSearchMailBox(SearchInfo);  // here is generated the error
  end;
  lParts := TIdImapMessageParts.Create(nil);
  if( IDImap.Connected=true) then begin
    for i := 0 to High(IDIMAP.MailBox.SearchResult) do begin
        MSG := TIdMessage.Create(nil);
        Id:=IDIMAP.MailBox.SearchResult[i];
        CurrUId:=Inttostr(IDIMAP.MailBox.SearchResult[i]);
        try

            if( not BdEmails.Locate('UID', currUID , [loCaseInsensitive])) then begin
              IDIMAP.UIDRetrieve( CurrUID, msg );
              IDImap.UIDRetrieveStructure(Inttostr(IDIMAP.MailBox.SearchResult[i]), lParts);
              attachs:=0;
              for lj := 0 to msg.MessageParts.Count - 1  do begin
                if msg.MessageParts.Items[lj] is TIdAttachment then  begin
                    if( lParts[lJ].FileName <>'') then begin
                        Inc(attachs);
                        IDImap.UidRetrievePartToFile(Inttostr(IDIMAP.MailBox.SearchResult[i]), lParts[lJ].ImapPartNumber, i , Path+'emails\attach\'+lParts[lJ].FileName, lParts[lJ].ContentTransferEncoding);
                        BDAttachs.Append;
                        BDAttachs.FieldByName('Account').AsString  :=BDAcct.FieldByName('emailAcc').AsString ;
                        BDAttachs.FieldByName('ID').AsInteger      :=id ;
                        BDAttachs.FieldByName('UID').AsString      := CurrUID;
                        BDAttachs.FieldByName('Attachs').AsInteger := lj;
                        BDAttachs.FieldByName('FileName').AsString := lParts[lJ].FileName;
                        BDAttachs.post;
                    end;
                  end;
              end;
//              fileName_MailSource := TmpFolder  + Inttostr(IDIMAP.MailBox.SearchResult[i])+ '.eml';
              BDEmails.Append;
              BDEmails.FieldByName('Account').AsString  := BDAcct.FieldByName('emailAcc').AsString;
              BDEmails.FieldByName('ID').AsInteger      := id;
              BDEmails.FieldByName('UID').AsString      := currUID ;
              BDEmails.FieldByName('Date').AsDateTime  := msg.Date;
              BDEmails.FieldByName('subject').AsString  := msg.Subject;
              BDEmails.FieldByName('attachs').AsInteger  := attachs;
              BDEmails.FieldByName('fromaddr').AsString := msg.From.Address;
              BDEmails.post;
          end;

        finally
          MSG.Free;
        end;

    end;
  end;
  BDEmails.First;

end;         


some examples to read unseen emails.... still using query search,.. or what i need to change to get that...

i can not download documentation of indy...

thanks..
any help great...



Attached Files Thumbnail(s)
   
Print this item

  How to make a Delphi Intraweb IWFrames work with IWTemplateProcessorHTML?
Posted by: Noobi$$ - 11-28-2023, 04:55 PM - Forum: IntraWeb General Discussion - Replies (1)

Hi all...
this is my first post I guess..

I'm using Delphi 11.3 with IW15.

I have multiple iwframes, using them as a body of my page beside a header and a footer. everything is working great until I decided to use IWTemplateProcessorHTML.

My problem is that each iwframe has a IWFrameRegion which cannot be renamed for some reasons (I don't know why), although I tried to rename it various ways however it's not renamable! for that it's impossible to apply a template for each iwframe because it will have the same file name IWFrameRegion.html therefor it will work only for one iwframe only!
Another try was by adding another IWRegion and then easily rename it after that applying the IWTemplateProcessorHTML on it but in the end, it renders nothing! (empty page).

Hence, this is how I call the iwframe to display it inside the body region:
  if frm1 = nil then
    begin
      frm1 := TIWFrame2.Create(self);
      frm1.Parent := IWRegion1;
      frm1.Visible := true;
    end;

So how to solve this issue? is my approach wrong? or there is another way to apply IWTemplateProcessorHTML to an iwframe? 

I've also attached a simple file for the problem.

Thanks.



Attached Files
.zip   FramesTest.zip (Size: 74.25 KB / Downloads: 4)
Print this item

  IntraWeb 15.5.2 is out!
Posted by: Alexandre Machado - 11-27-2023, 05:58 AM - Forum: IntraWeb General Discussion - Replies (6)

Hi guys,

a few bugs fixed and there is a new update available:

https://www.atozed.com/2023/11/intraweb-15-5-2/

Enjoy!  Big Grin

Print this item

  how to show datalabel in iwchartjs
Posted by: cyrus.mombaini - 11-26-2023, 01:00 PM - Forum: IntraWeb General Discussion - Replies (1)

how to show datalabel in iwchartjs

Print this item

  IW v15.5.x - error in design mode
Posted by: brsoft - 11-26-2023, 10:21 AM - Forum: IntraWeb General Discussion - Replies (6)

Hi Alexandre!

Parameters: Delphi v11.3, IntraWeb v15.5.x

In IWForm design, deleting the IWRegion creates a system error (attached video)
This works fine with Intraweb v15.4.2.

Can you help me in this?

Best regards:
Robert



Attached Files Thumbnail(s)
   

.zip   demoproject.zip (Size: 6.86 KB / Downloads: 3)
.zip   screenvideo.zip (Size: 271.22 KB / Downloads: 3)
Print this item