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.
//...
var
errorlevel: Integer;
begin
if cond1=cond2 then errorlevel:=0;
if cond1<>cond2 then errorlevel:=1;
halt(errorlevel);
end.
74
Delphi
Typenkonvertierung
String in Integer konvertieren
MyInt:=StrToInt('125');
75
C#
Typenkonvertierung
String in Integer konvertieren
int MyInt
if (Int32.TryParse("125", out MyInt))
{
// Parsing was successfull
}
76
Python
Netzwerk, Email
Email versenden
# Found at (and little modified): http://www.semi-legitimate.com/sls/blog/37-quick-notes/62-command-line-smtp-from-python
#!/usr/bin/python
import smtplib, sys
if len(sys.argv) != 5:
print "You must call me like:"
print " mailme from to subject msgfile"
sys.exit()
fromadr = sys.argv[1]
toadr = sys.argv[2]
subject = sys.argv[3]
msgfile = sys.argv[4]
try:
f = open(msgfile)
msg = f.read()
except:
print "Invalid Message File: " + msgfile
sys.exit()
m = "From: %s
To: %s
Subject: %s
X-Mailer: My-Mail
" \
% (fromadr, toadr, subject)
smtpserver="mysmtp.lan"
loginuser="Marty_McFly"
loginpwd="DeLorean"
smtp = smtplib.SMTP()
smtp.connect(smtpserver)
smtp.login(loginuser, loginpwd)
smtp.ehlo()
smtp.sendmail(fromadr, toadr, m+msg)
smtp.close()
77
Delphi
Filehandling
Applikations-/Script-Verzeichnis ermitteln
AppPath:=ExtractFilePath(Application.Exename);
78
Delphi
Anwendungskonfigurationsdateien
INI-Datei lesen
uses
IniFiles;
var
iniMem: TMemIniFile; // ini-File (ready only one time)
// Load the ini-information once - maybe at startup
function TMyForm.LoadIniFile:boolean;
var
SL : TStringList;
return : Boolean;
iniFile : String;
begin
iniFile:='myFormConfig.ini';
return:=true;
if not FileExists(ExtractFilePath(Application.Exename)+iniFile) then
begin
MessageDlg('ini-File not found!', mtError, [mbOK], 0);
return:=false;
end;
if not return then halt;
iniMem:=TMemIniFile.Create('');
SL:=TStringList.Create;
SL.LoadFromFile(ExtractFilePath(Application.Exename)+iniFile);
iniMem.SetStrings(SL);
LoadIniFile:=return;
end;
procedure TMyForm.DoThis;
begin
ShowMessage(iniMem.ReadString('Section','Attribute','Default-Value'));
end;
79
T-SQL
Datenbank, Collation
Datensatz Case-Sesitive abfragen
-- Table containing Values
-- content (column)
-- a
-- A
SELECT content FROM myTable WHERE content='A' COLLATE SQL_Latin1_General_CP1_CS_AS
-- Result: A
80
T-SQL
Datenbank, Collation
Collation (Sortierreihenfolge) einer Datenbank ändern
-- Collation einer Multi-User Datenbank ändern
-- Über SSMS kommt die Fehlermeldung 5030 (Die Datenbank konnte nicht exklusiv gesperrt werden, um den Vorgang auszuführen.)
-- siehe dazu: http://sunali.com/2009/10/08/microsoft-sql-server-error-5030/
-- the following line sets the database to "Single User" mode
ALTER DATABASE MYDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
-- the following line sets the new collation
ALTER DATABASE MYDB COLLATE Latin1_General_CS_AS
-- the following line sets the database back to "Multi User" mode
ALTER DATABASE MYDB SET MULTI_USER
81
T-SQL
Datenbank, Collation
Collation-Arten auflisten
-- siehe auch: http://msdn.microsoft.com/de-de/library/ms187963.aspx
SELECT *
FROM fn_helpcollations()
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")