You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.
Set stream=##class(%FileCharacterStream).%New()
Set stream.Filename="c:\myfile.txt"
While 'stream.AtEnd
{
Set line=stream.ReadLine()
; Process the line here
}
19
Caché
Caché-Spezifisch, Namespaces
Prüfen ob ein Namespace existiert
If $ZUtil(90,10,"SAMPLES")
{
ZNSpace "SAMPLES"
}
24
Caché
Caché-Spezifisch, Netzwerk
Superserver-Port
W !,$ZU(172,0) ; z.B. 1972
34
Caché
Caché-Spezifisch, Prozesse/Jobs
Variableninhalt eines fremden Prozesses ermitteln
; Important: You musn't check variables in your own job, it will result in a <PARAMETER>-Error!
Set checkjob=1234
Set checkvar="foo"
; Check if job is not my own
Quit:checkjob=$Job
; Check if Job exists und prompt the content of the varible foo
If $Data(^$Job(checkjob)) W !,$ZUtil(88,2,checkjob,checkvar)
; Prompts the content of the variable foo, maybe it is 'bar' ;-)
82
Caché
Textdateien
Textdatei schreiben
Set file=##class(%File).%New("file.txt")
Write file.Size
Do file.Open("WSN")
Do file.WriteLine("This is a line of text")
26
Delphi
Exceptions
Try Catch Except
try
// Code
except
// Handle the exception here...
end;
27
Delphi
Datum, Zeit
Aktuelles Datum/Uhrzeit
str:=FormatDateTime('yyyymmdd hhnnss',now);
// gibt aus 20100331 120723
28
Delphi
Prozeduren, Funktionen, Methoden
Verarbeitung gezielt beenden
procedure TForm1.Proz(Sender: TObject);
begin
If 1<>2 Then exit;
ShowMessage('Test');
end;
44
Delphi
Filehandling
Datei auf dem Betriebssystem ausführen
procedure TForm1.MenuDummy1Click(Sender: TObject);
var
ExeName : array[0..255] of char;
myFile : String;
begin
myFile:='winword.exe';
Showmessage('Starte: ' + myFile);
StrPCopy(ExeName, myFile);
ShellExecute(MainForm.Handle, 'open', ExeName, nil, nil, SW_SHOWNORMAL);
// Drucken geht dann so (siehe auch Dateitypen im Windows Explorer):
ShellExecute(MainForm.Handle, 'print', ExeName, nil, nil, SW_SHOWNORMAL);
end;
55
Delphi
GUI, Komponenten allgemein
Mit Return ein Ereignis im Textfeld auslösen
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
ShowMessage('Auswerten ...');
end;
end;