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.
@echo off
SET mydir=%CD%
set /p number=search this number?:
echo %number% > "%mydir%\lastnumbersearched.txt"
echo dir/b/s *%number%*.*
echo.
echo.
dir/b/s *%number%*.*
echo.
echo.
pause
268
T-SQL
Encoding / Decoding
Checksumme
SELECT
[CHECKSUM_1] = CHECKSUM(Column1, Column2)
FROM
TableA
125
Python
Encoding / Decoding
Datei nach Base64 encodieren
myfile = 'myDoc.pdf'
ReturnValue = open(myfile).read().encode("base64")
# in ReturnValue ist nun der Base64-String
126
C#
Encoding / Decoding
Datei nach Base64 encodieren
myfile = "myPDF.pdf";
string ReturnValue = "";
if (System.IO.File.Exists(myfile)) {
using (FileStream BinaryFile = new FileStream(myfile, FileMode.Open)) {
BinaryReader BinRead = new BinaryReader(BinaryFile);
byte[] BinBytes = BinRead.ReadBytes(Convert.ToInt32(BinaryFile.Length));
ReturnValue = Convert.ToBase64String(BinBytes);
BinaryFile.Close();
}
}
191
Python
Encoding / Decoding
md5-Hash erzeugen
# https://docs.python.org/2/library/hashlib.html
import hashlib
a = "hello world"
b = 0.1
md5str = hashlib.md5(str(b) + a).hexdigest()
89
C#
Kontrollstrukturen
Switch / Case Anweisung
int i = 1;
switch (i)
{
case 1:
Console.WriteLine("Fall 1");
break;
case 2:
Console.WriteLine("Fall 2");
break;
default:
Console.WriteLine("Standard Fall");
break;
}
118
T-SQL
Kontrollstrukturen
Switch / Case Anweisung
-- http://msdn.microsoft.com/de-de/library/ms181765.aspx
USE AdventureWorks2008R2;
GO
SELECT ProductNumber, Category =
CASE ProductLine
WHEN 'R' THEN 'Road'
WHEN 'M' THEN 'Mountain'
WHEN 'T' THEN 'Touring'
WHEN 'S' THEN 'Other sale items'
ELSE 'Not for sale'
END,
Name
FROM Production.Product
ORDER BY ProductNumber;
GO
114
Android
GUI, ComboBox
ComboBox füllen
public void fillSpn()
{
String dummyarr[];
Spinner spn1 = (Spinner) findViewById(R.id.spn1);
// Dummy Data
dummyarr = new String[5];
int i;
for (i=0;i<5;i++)
{
dummyarr[i]=String.valueOf(i);
}
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, dummyarr);
spn1.setAdapter(adapter);
}
112
Android
GUI, Dialoge
Hinweis-Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Hinweis")
.setTitle("Hinweis-Meldung")
.setNeutralButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
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();