This file contains hidden or 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
# Start VM | |
boot2docker start | |
# Show VM status | |
boot2docker status | |
# Start an nginx container "web" on the docker_host (the vm) | |
# -d keeps the container running in the background | |
# -P publishes exposed ports from the container to your local host (öffnet die vom Container genutzten Ports) | |
# --name assigns a name to the container |
This file contains hidden or 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
# Create a file and insert some text with the ">" operator | |
echo "my new site" > index.html | |
# Show PATH | |
echo $PATH # /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin | |
# /usr/local/bin is in the PATH by default | |
# Create symbolic link (symlink) | |
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime |
This file contains hidden or 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
REM Display text file in shell | |
type config.json | |
REM Show running processes | |
tasklist | |
REM Kill process bei PID | |
taskkill /pid 1060 | |
REM Get Command Line and PID of one process |
This file contains hidden or 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
-- Remove All Rows from a Table | |
TRUNCATE TABLE user; | |
-- Create a CHECK constraint to ensure consistency within the tables (e.g. for enumeration values or for consistency rules based on multiple columns) | |
-- Unnamed inline CHECK constraint | |
CREATE TABLE Persons ( | |
Age int CHECK (Age>=18) | |
); | |
-- Named inline CHECK constraint |
This file contains hidden or 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
There is a MANIFEST.MF file in .jar files | |
It supports a wide range of functionality: | |
* electronic signing | |
* version control | |
* package sealing | |
It always sits in "META-INF/MANIFEST.MF" | |
The creation of a .jar file includes the creation of a default manifest file |
This file contains hidden or 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
// imports a couple of java tasks | |
apply plugin: "java" | |
// List available tasks in the shell | |
> gradle tasks | |
// A Closure that configures the sourceSets Task | |
// Sets the main folder as Source folder (where the compiler is looking up the .java files) | |
sourceSets { | |
main.java.srcDir "src/main" |
This file contains hidden or 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
// VM Arguments vs. Program Arguments | |
// Program Arguments are accessible via the main() methods String[] args array | |
// VM Arguments are accessible via System.getProperty(<vm-arg-name>) | |
java [-D<vm-arg-name>=<vm-arg-value>] MyJavaProgram [<program-arg-value>] | |
// Activate Remote Debugging on JVM via Java Debug Wire Protocol (JDWP) | |
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777 | |
// Listening for a debugger to connect: Yes or No | |
// No: JVM tries to connect to a debugger under the "address" field |
This file contains hidden or 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
// Find the entity with the latest insert timestamp | |
@Repository | |
public interface MyEntityRepo extends JpaRepository<MyEntity, Long> { | |
MyEntity findFirstByOrderByInsertTimestampDesc(); | |
} |
This file contains hidden or 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
// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation | |
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration | |
@SpringBootApplication | |
public class FooApplication { | |
public static void main(String[] args) { | |
// Bootstrap the application | |
SpringApplication.run(FooApplication.class, args); | |
} | |
} |
This file contains hidden or 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
// Return JSON without Jackson mapping classes | |
@RequestMapping("/users") | |
public @ResponseBody Map<String, String> getUsers () { | |
Map<String, String> map = new HashMap<String, String>(); | |
map.put("user", "Clark Kent"); | |
return map; | |
} |
NewerOlder