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.
// Orginal von: http://www.sebastianviereck.de/php-nicht-schreibbare-dateien-finden-und-beheben/
function checkFileWritable($file)
{
if(!file_exists($file))
{
file_put_contents($file, "");
}
if(!chmod($file, 0644))
{
$fileowner = fileowner($file);
echo "counld not change File Permissions: $file, File Owner is: $fileowner";
if(!chown($file, ftpUserID))
{
echo "counld not change File owner: $file ";
mail(mailadresse, "Schreibeprobleme","File: $file, File Owner is: $fileowner");
}
}
}
113
Android
GUI, Dialoge
Abfrage-Dialog
// siehe auch : http://developer.android.com/guide/topics/ui/dialogs.html
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
WhatHaveYouDoneActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
73
Delphi
Windows - Prompt Errorlevel
Errorlevel setzen
//...
var
errorlevel: Integer;
begin
if cond1=cond2 then errorlevel:=0;
if cond1<>cond2 then errorlevel:=1;
halt(errorlevel);
end.
84
C#
Variablen
Darstellung eines Unicode Zeichens in C#
//Hier wird in die Variable "semikolon" das Semikolon eingetragen
var semikolon = (char)59;
239
PHP
Strings
Text in Großschrift oder Kleinschrift
//http://us2.php.net/manual/de/function.strtoupper.php
$myString = "my lovely Mr Singing Club";
echo strtoupper($myString);
// MY LOVELY MR SINGING CLUB
//http://php.net/manual/de/function.strtolower.php
echo strtolower($myString);
8
Caché
Datum, Zeit
Aktuelles Datum/Uhrzeit
; Datum und Uhrzeit formatiert ausgeben
Set datuhr=$ZDateTime($Horolog,8)
; ergibt 20100308 09:47:36
; nur Datum
Set dat=$ZDate($Horolog,3) ; = 2010-03-08
; nur Zeit
Set uhr=$ZTime($Piece($H,",",2)) ; = 09:50:20
12
Caché
Datenbank
Lesen Datensatzes
; Es existiert eine Tabelle namens Table.Cities welche einen Eintrag mit der ID=15 enthält. Diese Tabelle enthält das Feld "Name"
Set ds=##class(Table.Cities).%OpenId(15)
Write !,ds.Name
; Oder über SQL
Set result = ##class(%Library.ResultSet).%New()
Set sql = "SELECT Name FROM Table.Cities WHERE ID=15"
Do result.Prepare(sql)
Do result.Execute("")
For
{
Quit:'result.Next()
Set name=result.Data("Name")
}
17
Caché
HTTP Form Submit
GET Link-Parameter lesen
; http://localhost:1972/csp/test/page.csp?name=john
Set linkparm=$Get(%request.Data("name",1))
Write !,linkparm ; = john
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' ;-)
11
Mumps
Datenbank
Lesen Datensatzes
; In M werden Tabellen Globals genannt
S id=1
W !,^TABLE(id)
S street="Hollywood Drive"
S city="Los Angeles"
W !,^PERSONS(street,city)
S temp=^GLOBAL(0,"test","temp1")