php-windows Digest 22 Nov 2007 14:15:28 -0000 Issue 3370

Topics (messages 28598 through 28600):

Re: infinite loop
        28598 by: Gustav Wiberg
        28599 by: Stut

COM - Problem with Dates
        28600 by: Oliver Espeter

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Why in earth do you want to create an infinite loop???
Seems to me that you should consider another solution without knowing why...


Best regards
/Gustav Wiberg
 

-----Original Message-----
From: Nishantha Pradeep [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 21, 2007 9:28 AM
To: php
Subject: [PHP-WIN] infinite loop

I want to run an infinite loop when my webserver start up.I can put that
loop inside my index.php but i have a few doubts
  01)shoul someone request the insex.php in oreder to start the loop
  02) if so,if 3 people request index.php,then will there be 3 infinite loop
                              Is there any way ?

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.2/1142 - Release Date: 2007-11-20 
17:44


--- End Message ---
--- Begin Message ---
Nishantha Pradeep wrote:
I want to run an infinite loop when my webserver start up.I can put that
loop inside my index.php but i have a few doubts
  01)shoul someone request the insex.php in oreder to start the loop
  02) if so,if 3 people request index.php,then will there be 3 infinite loop
                              Is there any way ?

Try telling us what you are trying to do rather than how you are trying to do it. Chances are good that there's a better way to accomplish your goal.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Hi,
I have problems fetching data from an special database over a com-based sdk. 
With VisualBasic it's not a problem,
but the same code doesn't work with php.

First some Data:
- The database system holds high compressed industrial data and is called 
OSI-PI. The system itself is under a
comercial license (OSI Soft Inc.).
- The distributor gave us a sdk - fully OO.
- The sdk has to be integrated over COM.
- My 1. testsystem: Windows 2000 Professional Version 5.00.2195 with php 
5.2.2
- My 2. testsystem: Windows 2003 Server with php 5.2.4

Here a code-sniplet from me that work:
1  <?php
2  $comObjPi = new COM('PISDK.PISDK');
3  $server = $comObjPi->Servers->Item("123.123.123.123");
4  $server->Open("123.123.123.123;UID=foo;pwd=bar");
5  $point = $server->PIPoints("SINUSOID");
6  echo "\n".$point->Data->SnapShot()->Value."\n";
7 echo "\n".$point->Data->SnapShot()->TimeStamp."\n";
8 ?>

Line 2 makes an object from the sdk. Line 3 and 4 builds up the connection 
to the server. Line 5 connects to
an datapoint (PI-Point/Sinosoid is a testpoint). Line 6 and 7 receive the 
last value and the last time that are stored
in the point. Everything WORKS FINE.

But when we use some other functions of the sdk, php throws some exceptions:

9  com_load_typelib('PISDK.PISDK');
10  echo "\nTest 1:\n";
11  try{
12   $value = $point->Data->ArcValue(new Variant(mktime(), VT_R8), 
rtBefore);
13  }
14  catch(Exception $e){
15   print("\nException Versuch 1 ".$e->getMessage()." TraceString: 
".$e->getTraceAsString());
16  }
17
18  echo "\nTest 2:\n";
19  try{
20   $value = $point->Data->ArcValue(variant_date_from_timestamp(mktime()), 
rtBefore);
21  }
22  catch(Exception $e){
23   print("\nException Versuch 2 ".$e->getMessage()." TraceString: 
".$e->getTraceAsString());
24  }
25
26 $server->Close();
27 ?>

Line 12/20: The function ArcValue is designed for calling archived values 
from a pi-point. It needs two values.
First the date/time as Long, Int, String..., nearly each format. The second 
value is a constant. We loaded all
of them in Line 9. We tested all types of variant for the first value, but 
each time it throws the following exception:

---
Test 1:
Exception Test 1 Parameter 0: Typkonflikt.  //Type-Mismatch in the english 
version
 TraceString: #0 C:\php_pi\pitest.php(12): 
variant->ArcValue(Object(variant), 6)
#1 {main}
Test 2:
Exception Test 2 Parameter 0: Typkonflikt.
 TraceString: #0 C:\php_pi\pitest.php(20): 
variant->ArcValue(Object(variant), 6)
#1 {main}
----

We tested other functions from the sdk. But each time we tried we lose. :-/ 
Fololowing an example written in
VisualBasic that works fine:

Imports pisdk
Public Class Form1
    Private Sub Form1_Click(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles Me.Click
        Dim MySdk As New PISDK.PISDK
        Dim pt As PIPoint
        Dim v As PIValues
        pt = MySdk.Servers.DefaultServer.PIPoints("sinusoid")
        v = pt.Data.PlotValues("1-Jan-07", "*", 1000)
        MsgBox(v.Count & " Elements")
    End Sub
End Class

It receives all datarows for the point "sinusoid" since first Jan and counts 
them. This example works with
VisualBasic but it didn't work on php.

Some programmers of OSI-Soft said that all functions takes objects as 
parameter so the type-mismatch is a
problem in php. Because of the working VB code I think they are right.

Has anyone a hint for me or a likewise problem with an other 
sdk/application?

Regards
Oliver

--- End Message ---

Reply via email to