This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Set the standard output stream as on a log file | |
*/ | |
String pathname = "C:\\Marco\\tmp\\WindowsServiceTut\\log.txt"; | |
FileOutputStream out = new FileOutputStream(new File(pathname), true); | |
PrintStream printStream = new PrintStream(out); | |
System.setOut(printStream); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* | |
* @param p_file Get File, which to check | |
* @return Returns true if it was modified, false if not | |
*/ | |
public static boolean wasModifiedToday(File p_file) | |
{ | |
// Datum abrufen | |
Date DateFile = new Date(p_file.lastModified()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Prueft ob die alten Logfiles verschoben werden muessen | |
* Bedingung: Logdatei wurde heute nicht geaendert | |
* | |
* @param p_logFilepath Pfad zum Logfileordner | |
* @param p_logFilename Dateiname (ohne .log & nummerierung) | |
* @param p_maxLogfiles Maximale Anzahl an Logfiles (wie lange Backupen) | |
* | |
* @throws Exception Fehlermeldung bei Zugriffsprobleme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.PrintWriter; | |
import java.io.StringWriter; | |
import java.text.SimpleDateFormat; | |
import java.time.LocalDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.util.Date; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date d = new Date(); | |
Calendar cal = Calendar.getInstance(); | |
cal.setTime(d); | |
GregorianCalendar c = new GregorianCalendar( | |
cal.get(Calendar.YEAR), | |
cal.get(Calendar.MONTH), | |
cal.get(Calendar.DAY_OF_MONTH), | |
cal.get(Calendar.HOUR_OF_DAY), | |
cal.get(Calendar.MINUTE), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
programname=MyAppName | |
start() | |
{ | |
screen -dmS $programname /path/to/executeable.sh start | |
} | |
stop() | |
{ | |
screen -X -S $programname quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
import java.io.PrintWriter; | |
import java.net.InetAddress; | |
public class getIpFromHostname { | |
public static void main(String[] args) { | |
InetAddress address; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.util.Date date = new SimpleDateFormat("dd.MM.yyyy HH:mm").parse("29.04.2017 20:00"); | |
System.out.println(date); | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
System.out.println(sdf.format(date.getTime())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ThreadExample { | |
public static void main(String[] args) { | |
try { | |
System.out.println("Starting Thread..."); | |
runner r = new runner(); | |
r.start(); | |
Thread.sleep(5_000); | |
r.halt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gibt an ob ein String ein Integer-Wert (Ganzzahl) darstellt | |
* | |
* @param p_str | |
* Zu pruefender String | |
* @return boolean-Wert | |
*/ | |
private static boolean isInteger(String p_str) { | |
if (p_str == null) | |
return false; |
OlderNewer