Hollosi Information eXchange /HIX/
HIX CODER 1517
Copyright (C) HIX
2002-05-11
Új cikk beküldése (a cikk tartalma az író felelőssége)
Megrendelés Lemondás
1 re:soros porti bufferben levo karakterek szama (mind)  139 sor     (cikkei)
2 RE: sql-poblema (mind)  27 sor     (cikkei)
3 Huffmann kontra Shanno (mind)  17 sor     (cikkei)
4 serial (mind)  15 sor     (cikkei)
5 *** HIX CODER *** #1515 (mind)  20 sor     (cikkei)

+ - re:soros porti bufferben levo karakterek szama (mind) VÁLASZ  Feladó: (cikkei)

Haho!

Amire szukseged van, az a ClearCommError()...
A COMSTAT strukturaban van input/output bufferben levo 
karakterszamrol info...
Itt a help rola.
Sok sikert
STeve

The ClearCommError function retrieves information about a 
communications error and reports the current status of a 
communications device. The function is called when a 
communications error occurs, and it clears the device's 
error flag to enable additional input and output (I/O) 
operations. 
BOOL ClearCommError(
    HANDLE hFile,	// handle to communications device
    LPDWORD lpErrors,	// pointer to variable to receive 
error codes
    LPCOMSTAT lpStat	// pointer to buffer for 
communications status  
   );	
 
Parameters
hFile
Identifies the communications device. The CreateFile 
function returns this handle. 
lpErrors
Points to a 32-bit variable to be filled with a mask 
indicating the type of error. This parameter can be one or 
more of the following error codes: 
Value	Meaning
CE_BREAK	The hardware detected a break condition.
CE_DNS	Windows 95 only: A parallel device is not selected.
CE_FRAME	The hardware detected a framing error.
CE_IOE	An I/O error occurred during communications with 
the device.
CE_MODE	The requested mode is not supported, or the hFile 
parameter is invalid. If this value is specified, it is the 
only valid error.
CE_OOP	Windows 95 only: A parallel device signaled that it 
is out of paper.
CE_OVERRUN	A character-buffer overrun has occurred. 
The next character is lost.
CE_PTO	Windows 95 only: A time-out occurred on a parallel 
device.
CE_RXOVER	An input buffer overflow has occurred. 
There is either no room in the input buffer, or a character 
was received after the end-of-file (EOF) character.
CE_RXPARITY	The hardware detected a parity error.
CE_TXFULL	The application tried to transmit a 
character, but the output buffer was full.
 
lpStat
Points to a COMSTAT structure in which the device's status 
information is returned. If lpStat is NULL, no status 
information is returned. 
 
Return Values
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get 
extended error information, call GetLastError. 
Remarks
If a communications port has been set up with a TRUE value 
for the fAbortOnError member of the setup DCB structure, 
the communications software will terminate all read and 
write operations on the communications port when a 
communications error occurs. No new read or write 
operations will be accepted until the application 
acknowledges the communications error by calling the 
ClearCommError function. 
The ClearCommError function fills the status buffer pointed 
to by the lpStat parameter with the current status of the 
communications device specified by the hFile parameter. 
See Also
ClearCommBreak, COMSTAT, CreateFile, DCB 


The COMSTAT structure contains information about a 
communications device. This structure is filled by the 
ClearCommError function. 
typedef struct _COMSTAT { // cst  
    DWORD fCtsHold : 1;   // Tx waiting for CTS signal 
    DWORD fDsrHold : 1;   // Tx waiting for DSR signal 
    DWORD fRlsdHold : 1;  // Tx waiting for RLSD signal 
    DWORD fXoffHold : 1;  // Tx waiting, XOFF char rec'd 
    DWORD fXoffSent : 1;  // Tx waiting, XOFF char sent 
    DWORD fEof : 1;       // EOF character sent 
    DWORD fTxim : 1;      // character waiting for Tx 
    DWORD fReserved : 25; // reserved 
    DWORD cbInQue;        // bytes in input buffer 
    DWORD cbOutQue;       // bytes in output buffer 
} COMSTAT, *LPCOMSTAT; 
 
Members
fCtsHold
Specifies whether transmission is waiting for the CTS 
(clear-to-send) signal to be sent. If this member is TRUE, 
transmission is waiting. 
fDsrHold
Specifies whether transmission is waiting for the DSR (data-
set-ready) signal to be sent. If this member is TRUE, 
transmission is waiting. 
fRlsdHold
Specifies whether transmission is waiting for the RLSD 
(receive-line-signal-detect) signal to be sent. If this 
member is TRUE, transmission is waiting. 
fXoffHold
Specifies whether transmission is waiting because the XOFF 
character was received. If this member is TRUE, 
transmission is waiting. 
fXoffSent
Specifies whether transmission is waiting because the XOFF 
character was transmitted. If this member is TRUE, 
transmission is waiting. Transmission halts when the XOFF 
character is transmitted to a system that takes the next 
character as XON, regardless of the actual character. 
fEof
Specifies whether the end-of-file (EOF) character has been 
received. If this member is TRUE, the EOF character has 
been received. 
fTxim
If this member is TRUE, there is a character queued for 
transmission that has come to the communications device by 
way of the TransmitCommChar function. The communications 
device transmits such a character ahead of other characters 
in the device's output buffer.
fReserved
Reserved; do not use. 
cbInQue
Specifies the number of bytes received by the serial 
provider but not yet read by a ReadFile operation. 
cbOutQue
Specifies the number of bytes of user data remaining to be 
transmitted for all write operations. This value will be 
zero for a nonoverlapped write. 
 
See Also
ClearCommError, ReadFile, TransmitCommChar
+ - RE: sql-poblema (mind) VÁLASZ  Feladó: (cikkei)

szia!

A localSQL nem a legszerencsésebb választás, sok funkciót nem ismer. De
ahogy elnézem, neked jó lenne a Table1 komponens és a Calculated Fields
opció. Ki lehetne számítgatni, hogy mennyit kell kivonogatni a mezok
értékébol.
Monjuk nem túl sok infót mondtál el. Ha érdekel, magánban segítek. Akár az
adatbázis is passzolhatod..

üdv: scsaba
______________________________________________________
Sziasztok!

Van egy kis SQL-problemam, amit sehogy sem tudok frappansan megoldani
(Delphi, localSQL, Paradox).
Van egy mastertabla, amelyben tarolva vannak a kolcsonok adatai (kolcson
osszege, felvetel datuma, stb.). Van egy detailtabla, amelyben a
torlesztesek vannak tarolva (kolcsonID, befizetett osszeg, befizetes datuma,
stb.). Nekem egy olyan eredmenytablara lenne szuksegem, amely így néz ki:
Oszlopok: Eves nyitoegyenleg; 1. negyedeves zaroegyenleg; 2. ne. zaroe.; 3.
ne. zaroe.; 4. ne. zaroe.;
Sorok: az aktualis evek, amelyekre van befizetes.
A lenyeg, hogy az 1. nyitoegyenlegbol (ami a kolcson teljes osszege) ki kell
vonogatni a befizeteseket. A 4. ne. zaroegyenleg megegyezik a kovetkezo evi
nyitoegyenleggel.
Azert fordultam a t. listahoz, mert itt elakadtam. Elore is koszonom a
segitsegeteket.
+ - Huffmann kontra Shanno (mind) VÁLASZ  Feladó: (cikkei)

On 7 May 02, at 9:33, sandorzsolt.1=dpg.hu wrote:

> Nagyon szepen lehet latni, hogy elszall a Shanno-Fano kod, amikor
> kicsi a w(i)-k kulonbsege, nagyon de nagyon, es akkor elkezded
> felirni mondjuk 2-es tort alakba, es igen sokaig ugyanazok jonnek
> ki, es csak a sokadik szamjegy fog kulonbozni, tehat baromi hosszu
> kodszavaink is lehetnek. 

Nem ertem, mire gondolsz. Mondanal egy peldat? Ha tenyleg ugy 
erted, ahogy gondolom (hogy szinte azonos a gyakorisaga az 
egyes kodszvaknak/betuknek kinek hogy tetszik), akkor teljesen 
normalis, hogy mindegyik kod ugyanolyan hosszu lesz, meghozza 
ez a hossz ld(n) felfele kerekitve, ahol n a kodszavak/betuk szama, 
ld pedig a kettes alapu logaritmus. Ennel jobbat ilyenkor nem lehet 
csinalni massal sem.

István
+ - serial (mind) VÁLASZ  Feladó: (cikkei)

On 6 May 02, at 9:19, veresp=delfin.klte.hu wrote:

> Win2000 es XP alatt kellene olyan c++ fv, amely megmondja,hogy van-e
> bejovo adat valamelyik soros porton.
> 
> (Ha ReadFile-t hasznalom ugy, hogy nem volt bejovo adat,akkor az addig var
> amig nem jon be valami!!!)

Pedig a ReadFile kell neked, de olvasd el figyelmesen az 'asynchronous 
read'-rol szolo dolgokat. Ha nincs keznel win32 api doksid, itt megtalalod 
pl. a ReadFile-ra vonatkozo reszeket:

http://msdn.microsoft.com/library/en-us/fileio/filesio_39id.asp

István
+ - *** HIX CODER *** #1515 (mind) VÁLASZ  Feladó: (cikkei)

> Nagyon szepen lehet latni, hogy elszall a Shanno-Fano kod, amikor
 > kicsi a w(i)-k kulonbsege, nagyon de nagyon, es akkor elkezded felirni
 > mondjuk 2-es tort alakba, es igen sokaig ugyanazok jonnek ki, es csak a soka
dik
 > szamjegy fog kulonbozni, tehat baromi hosszu kodszavaink is lehetnek.

Ezt nem egeszen ertem. A SF egy binaris fat epit fel, ahol barmely
csomopont ket reszfajan levo szimbolumok elofordulasi valoszinusege
nagyjabol azonos. Ha N szimbolum van, a legrosszabb esetben,  a fa
N-1 magas lehet, azaz a leghosszabb kodszo N-1 bit. Ez azonban azt
jelenti, hogy a gyoker egyik oldalan allo maganyos szimbolum (amit 1
bit fog kodolni) nagyjabol akkora valoszinuseggel fordul elo, mint az
osszes tobbi egyuttveve. Az a szimbolum, aminek a kodszava N-1 bit
hosszu rendkivul kicsi gyakorisaggal szerepel csak a tablaban.
A Huffman is general egyebkent hosszu kodszavakt, ugyanerre az extrem
eloszlasra hasonlot ad. Mind a ketto egy binaris fat epit fel es mint
olyan, a fa magassaga (azaz a kodszavak max hosszusaga) log2(N) es N-1
koze esik, fuggetlenul az eljarastol, ami a fat felepiti.

Zoltan

AGYKONTROLL ALLAT AUTO AZSIA BUDAPEST CODER DOSZ FELVIDEK FILM FILOZOFIA FORUM GURU HANG HIPHOP HIRDETES HIRMONDO HIXDVD HUDOM HUNGARY JATEK KEP KONYHA KONYV KORNYESZ KUKKER KULTURA LINUX MAGELLAN MAHAL MOBIL MOKA MOZAIK NARANCS NARANCS1 NY NYELV OTTHON OTTHONKA PARA RANDI REJTVENY SCM SPORT SZABAD SZALON TANC TIPP TUDOMANY UK UTAZAS UTLEVEL VITA WEBMESTER WINDOWS