Tutorial by Examples: c

Classes and methods are usually defined in the Smalltalk IDE. Classes A class definition looks something like this in the browser: XMLTokenizer subclass: #XMLParser instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'XML-Parser' This is actually...
You can create extension methods to improve usability for nested collections like a Dictionary with a List<T> value. Consider the following extension methods: public static class DictListExtensions { public static void Add<TKey, TValue, TCollection>(this Dictionary<TKey, TColl...
private final Logger logger = Logger.getLogger(getClass().getCanonicalName()); WebView webView = new WebView(); webEngine = webView.getEngine(); webEngine.setOnAlert(event -> logger.warning(() -> "JS alert: " + event.getData()));
When using a WebView to display your own custom webpage and this webpage contains Javascript, it might be necessary to establish a two-way communication between the Java program and the Javascript in the web page. This example shows how to setup such a communication. The webpage shall display an i...
Problem Cross-Site Request Forgery or CSRF can force an end user to unknowingly generate malicious requests to a web server. This attack vector can be exploited in both POST and GET requests. Let's say for example the url endpoint /delete.php?accnt=12 deletes account as passed from accnt parameter ...
The chart consists out of HTML container and the JavaScript code that instantiates a chart in it. HTML We use a <div> element as chart container. <div id="chartdiv" style="height: 300px;"></div> JavaScript To instantiate the chart we use AmCharts.makeChar...
Bash can easily create lists from alphanumeric characters. # list from a to z $ echo {a..z} a b c d e f g h i j k l m n o p q r s t u v w x y z # reverse from z to a $ echo {z..a} z y x w v u t s r q p o n m l k j i h g f e d c b a # digits $ echo {1..20} 1 2 3 4 5 6 7 8 9 10 11...
Sometimes it's useful to test private & protected methods as well as public ones. class Car { /** * @param mixed $argument * * @return mixed */ protected function drive($argument) { return $argument; } /** * @return bool *...
Selection with increasing scope This comes handy when you want to select a block to extract a variable / method etc, no need to do a precise bracket matching, just put the caret somewhere in the statement and keep doing this Windows: Ctrl + W OS X / macOS: Cmd + W Selection with decreasing scope...
A for-each loop in Less has the same key components as a for loop except for the following differences: A variable which contains the list of items that has to be iterated over. An extract() function to extract each item in the variable based on the loop's index. A length() function to calculat...
The only major differences between this and a regular TCP connection are the private Key and the public certificate that you’ll have to set into an option object. How to Create a Key and Certificate The first step in this security process is the creation of a private Key. And what is this private ...
CREATE TABLE users (username text, email text); CREATE TABLE simple_users () INHERITS (users); CREATE TABLE users_with_password (password text) INHERITS (users); Our three tables look like this: users ColumnTypeusernametextemailtext simple_users ColumnTypeusernametextemailtext users_with_p...
With AspNetCore you can develop the application on any platform including Mac,Linux,Window and Docker. Installation and SetUp Install visual Studio Code from here Add C# extesnion Install dot net core sdk. You can install from here Now you have all the tools available. To develop the applic...
public class AuthenticationHandler : DelegatingHandler { /// <summary> /// Holds request's header name which will contains token. /// </summary> private const string securityToken = "__RequestAuthToken"; /// <summary> ...
Main process source code index.js: const {app, BrowserWindow, ipcMain} = require('electron') let win = null app.on('ready', () => { win = new BrowserWindow() win.loadURL(`file://${__dirname}/index.html`) win.webContents.openDevTools() win.on('closed', () => { win = null ...
After launching Visual Studio 2015, go to File → New → Project. In the New Project dialog box, browse in the templates tree to Visual C# → Windows → Universal and select Blank App (Universal Windows). Next, we need to fill the form to describe the Application: Name: this is the name of the appli...
The following example shows how to instantiate a class for logging via the ServiceLoader. Service package servicetest; import java.io.IOException; public interface Logger extends AutoCloseable { void log(String message) throws IOException; } Implementations of the service The...
JavaFX provides an easy way to internationalize your user interfaces. While creating a view from an FXML file you can provide the FXMLLoader with a resource bundle: Locale locale = new Locale("en", "UK"); ResourceBundle bundle = ResourceBundle.getBundle("strings", loc...
A Resource bundles contain locale-specific objects. You can pass the bundle to the FXMLLoader during its creation. The controller must implement Initializable interface and override initialize(URL location, ResourceBundle resources) method. The second parameter to this method is ResourceBundle which...
Apple introduced ATS with iOS 9 as a new security feature to improve privacy and security between apps and web services. ATS by default fails all non HTTPS requests. While this can be really nice for production environments, it can be a nuisance during testing. ATS is configured in the target's Inf...

Page 468 of 826