Forum poświęcone PHP

Posted by NET  • 

[Delphi/Pascal] SubStr pola a pozycje w DBCombo
Witam, chciałbym się dowiedzieć czy jest może komponent który ułatwi mi realizację zadania : - w TAB1 w kolumnie LISTA mamy po przecinku wypisane identyfikatory rekordów (ID) - w TAB2 są rekordy z polami ID oraz OPIS Na podstawie tych dwóch tabel potrzebuję zbudować Combo, dla którego pozycjami będą rekordy z kolumny TAB2.OPIS dla identyfikatorów zawartych w TAB1.LISTA Dobrze byłoby dodać np. mechanizm usuwania elementów z combo (z pola TAB1.LISTA został by usunięty wybrany identyfikator). Jeśli nie ma takiego komponentu (a tak chyba jest), to jak to można zgrabnie zrobić ? Pozdrawiam
Fri,21 Nov 2008 09:49:42 +0100

[C# i .NET] Liczenie długości tablicy
Witam! Mam pewna tablice bajtów składająca sie z n elementów: bufor[0] = Id[0] bufor[...] = a[...]; bufor[n] = b[n] Od [0] do [24] to nagłowek, a pozostale elementu to dane. W części nagłówkowej chce umieścić zmienną reprezetująca długość tablicy, ale tylko częsci danych bez nagłowka. Jest taka opcja jak Length, czyli w moimbufor.Length ale ona zwraca dl calej tablicy. Dl_tel = ascii.GetBytes(bufor.Length.ToString()); ... bufor[22] = Dl_tel[0]; bufor[23] = Dl_tel[1]; Czy jest jakas inna funkcja która liczy długoąć tablicy od np, 24 indeksu z w dól? lub Jak pomieszyc owe bufor.Length o 24??? Pozdro
Fri,21 Nov 2008 09:42:12 +0100

[Newbie] [Java] Istnieje taka funckja ?
Jaka funkcja jest w Java, która w Delphi jest mod
Fri,21 Nov 2008 09:27:26 +0100

[C/C++] [C++] Sterownik wagi
Witam. Chciałem zapytać, czy ktoś orientuje się może jak skomunikować komputer ze sterownikiem wagi, aby móc odczytać aktualną wagę? Waga podłączona jest do komputera poprzez port COM, komunikacja normalnie poprzez RS-232. Z góry wielkie dzięki za pomoc. Pozdrawiam.
Fri,21 Nov 2008 09:10:27 +0100

[C# i .NET] [C#] Makro MSAccess
Witam. Czy można uruchomić makro w MSAccess z poziomu C# ? Szukam w necie, ale jakoś ciężko coś znaleźć na ten temat. Proszę o pomoc, ewentualnie jakieś linki PdR
Fri,21 Nov 2008 09:03:47 +0100

Expect Functions

XXXV. Expect Functions

Wstęp

This extension allows to interact with processes through PTY. You may consider using the expect:// wrapper with the filesystem functions which provide a simpler and more intuitive interface.

Wymagania

This module uses the functions of the expect library. You need libexpect version >= 5.43.0.

Instalacja

To rozszerzenie PECL nie jest dołączane do PHP. Informacje na temat instalacji tego rozszerzenia PECL można znaleźć w podręczniku w rozdziale zatytułowanym Instalacja rozszerzeń PECL. Dodatkowe informacje, takie jak nowe wersje, pliki do pobrania, pliki źródłowe, informacje o opiekunach czy rejestr zmian, można znaleźć tutaj: http://pecl.php.net/package/expect.

W PHP 4 to rozszerzenie PECL można znaleźć w podkatalogu ext/ źródeł PHP lub pod znajdującym się wyżej odnośnikiem PECL. In order to use these functions you must compile PHP with expect support by using the --with-expect[=DIR] configure option.

Windows users will enable php_expect.dll inside of php.ini in order to use these functions. W PHP 4 ten DLL znajduje się w podkatalogu extensions/ binarnej dystrybucji PHP dla Windows. DLL z tym rozszerzeniem PECL można pobrać ze strony PHP Downloads lub http://snaps.php.net/.

Konfiguracja uruchomieniowa

Na działanie tych funcji wpływają ustawienia zawarte w pliku php.ini.

In order to configure expect extension, there are configuration options in the configuration file php.ini.

Tabela 1. Expect Opcje konfiguracyjne

NazwaDomyślnieZmienialneChangelog
expect.timeout"10"PHP_INI_ALL 
expect.loguser"1"PHP_INI_ALL 
expect.logfile""PHP_INI_ALL 
Szczegóły i definicje dotyczące stałych PHP_INI_* znajdują się w rozdziale Dodatek G.

Oto krótkie wyjaśnienie dyrektyw konfiguracji.

expect.timeout integer

The timeout period for waiting for the data, when using the expect_expectl() function.

A value of "-1" disables a timeout from occurring.

Notatka: A value of "0" causes the expect_expectl() function to return immediately.

expect.loguser boolean

Whether expect should send any output from the spawned process to stdout. Since interactive programs typically echo their input, this usually suffices to show both sides of the conversation.

expect.logfile string

Name of the file, where the output from the spawned process will be written. If this file doesn't exist, it will be created.

Notatka: If this configuration is not empty, the output is written regardless of the value of expect.loguser.

Typy zasobów

To rozszerzenie nie posiada żadnych rodzajów zasobów.

Stałe predefiniowane

Poniższe stałe są zdefiniowane w tym rozszerzeniu i stają się dostępne, gdy rozszerzenie jest dokompilowane do PHP, lub załadowane dynamicznie przy starcie.

EXP_GLOB (integer)

Indicates that the pattern is a glob-style string pattern.

EXP_EXACT (integer)

Indicates that the pattern is an exact string.

EXP_REGEXP (integer)

Indicates that the pattern is a regexp-style string pattern.

EXP_EOF (integer)

Value, returned by expect_expectl(), when EOF is reached.

EXP_TIMEOUT (integer)

Value, returned by expect_expectl() upon timeout of seconds, specified in value of expect.timeout

EXP_FULLBUFFER (integer)

Value, returned by expect_expectl() if no pattern have been matched.

Przykłady

This example connects to the remote host via SSH, and prints the remote uptime.

Przykład 1. Expect Usage Example

<?php
ini_set
("expect.loguser", "Off");

$stream = fopen ("expect://ssh root@remotehost uptime", "r");

$cases = array (
  array (
0 => "password:", 1 => PASSWORD)
);

switch (
expect_expectl ($stream, $cases))
{
case
PASSWORD:
  
fwrite ($stream, "password\n");
  break;

default:
  die (
"Error was occurred while connecting to the remote host!\n");
}

while (
$line = fgets ($stream)) {
  print
$line;
}
fclose ($stream);
?>
Spis treści
expect_expectl -- Waits until the output from a process matches one of the patterns, a specified time period has passed, or an EOF is seen
expect_popen -- Execute command via Bourne shell, and open the PTY stream to the process