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
| <h1>php htmlspecialchars()</h1> | |
| <h3>without END_QUOTES flag is an xss attack possible:</h3> | |
| <?php | |
| echo "<a href='" . htmlspecialchars("'onmouseover='a()'") . "'>link</a><br/>"; | |
| echo "<textarea style='overflow: none; width: 350px; border: none; resize: none; line-break: none;'>"; | |
| echo "<a href=''onmouseover='a()''>link</a>"; | |
| echo "</textarea><br/>"; | |
| echo "<a href='" . htmlspecialchars("'onmouseover='alert(123)'") . "'>link</a><br/>"; | |
| echo "<textarea style='overflow: none; width: 350px; border: none; resize: none; line-break: none;'>"; |
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
| package app; | |
| import javax.websocket.OnClose; | |
| import javax.websocket.OnMessage; | |
| import javax.websocket.OnOpen; | |
| import javax.websocket.Session; | |
| import javax.websocket.server.ServerEndpoint; | |
| import java.util.Collections; | |
| import java.util.HashSet; | |
| import java.util.Set; |
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
| FROM java:openjdk-8-jdk | |
| ADD target/demo-swarm.jar /opt/demo-swarm.jar | |
| EXPOSE 8081 | |
| ENTRYPOINT ["java", "-jar", "/opt/demo-swarm.jar"] |
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
| <?php | |
| //print_r($_SERVER['REQUEST_METHOD']); | |
| switch($_SERVER['REQUEST_METHOD']) { | |
| case 'GET': | |
| echo 'GET'; // do anything | |
| break; | |
| case 'POST': | |
| echo 'POST'; // do anything | |
| break; | |
| case 'PUT': |
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
| // ******* JAVA PROJECT "1": ******* | |
| import javax.ws.rs.ApplicationPath; | |
| import javax.ws.rs.core.Application; | |
| @ApplicationPath("/api/v1") | |
| public class ApplicationConfiguration extends Application { } |
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
| public class NestedCategories | |
| { | |
| public static void main(String[] args) { | |
| new NestedCategories(); | |
| } | |
| NestedCategories() { | |
| List<Category> fullCategoryList = new ArrayList<>(); | |
| fullCategoryList.add(new Category(1, 0)); |
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
| import com.google.inject.AbstractModule; | |
| import com.google.inject.Guice; | |
| import com.google.inject.Inject; | |
| import com.google.inject.Injector; | |
| import javax.inject.Singleton; | |
| public class MainApp { | |
| public static void main(String[] args) { | |
| Injector injector = Guice.createInjector(new AppInjector()); |
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
| import com.google.common.eventbus.EventBus; | |
| public class GoolgeGuavaEventBus | |
| { | |
| public static void main(String[] args) { | |
| EventBus eventBus = new EventBus(); | |
| //register the receiver | |
| Listener1 l1 = new Listener1(); | |
| Listener2 l2 = new Listener2(); | |
| eventBus.register(l1); |
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
| import anwendung.Bank; | |
| import anwendung.Gescheaftskonto; | |
| import anwendung.PrivatKonto; | |
| public class App | |
| { | |
| public static void main(String[] args) { | |
| // you can implement DI with setter injection or with constructor injection. | |
| // below you see an example with constructor injection |
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
| @java.lang.FunctionalInterface | |
| interface Math | |
| { | |
| public int calc(int a, int b); | |
| } | |
| public class LambdaExample | |
| { | |
| public static void main(String[] args) { | |
| // define your function |