Tutorial by Examples: f

The following class can be used as a single class that can handle GET, POST, PUT, PATCH, and other requests: class APIResponseObject{ int responseCode; String response; APIResponseObject(int responseCode,String response) { this.responseCode = responseCode; ...
Basics A Queue is a collection for holding elements prior to processing. Queues typically, but not necessarily, order elements in a FIFO (first-in-first-out) manner. Head of the queue is the element that would be removed by a call to remove or poll. In a FIFO queue, all new elements are inserted a...
To start using FTP with Java, you will need to create a new FTPClient and then connect and login to the server using .connect(String server, int port) and .login(String username, String password). import java.io.IOException; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.n...
SourceCookifier parses the current source code for such components as class, function, and variable names and displays them in a tree view at a side panel. Navigation among these members is possible by double-clicking on the component name. The plugin supports a number of languages and customization...

if

Introduces an if statement. The keyword if must be followed by a parenthesized condition, which can be either an expression or a declaration. If the condition is truthy, the substatement after the condition will be executed. int x; std::cout << "Please enter a positive number." &lt...
Examples of using functions with hotkeys: Hotkey, a, MyFunction ; Calls MyFunction() when a is pressed MyFunction() { MsgBox You pressed %A_ThisHotkey%. } Or: a::MyFunction() MyFunction() { MsgBox You pressed %A_ThisHotkey%. }
#Persistent Menu, Tray, NoStandard ; remove default tray menu entries Menu, Tray, Add, MyDefaultAction, OnDefaultTrayAction ; add a new tray menu entry Menu, Tray, Add, Exit, Exit ; add another tray menu entry Menu, Tray, Default, MyDefaultAction ;When doubleclicking the tray icon, run the tra...
I'll demonstrate the basic usage of using functions vs using labels+gosub. In this example we'll implement simple functionality to add two numbers and store them in a variable. With functions: c := Add(3, 2) ; function call MsgBox, Result: %c% Add(a, b) { ; This is a function. Put it wherever...
The following code is taken from he official AutoHotkey documentation: Function implementation: #Persistent OnClipboardChange("ClipChanged") return ClipChanged(Type) { ToolTip Clipboard data type: %Type% Sleep 1000 ToolTip ; Turn off the tip. } Label implementati...
This script demonstrates how to receive complicated GUI events from different controls in the same event callback function. We'll be using two ListView controls for that. Now every time an action is detected on one of those ListView controls, we want a precise description of what happened and have ...
Some people recommend that you should apply various tests to a file before attempting to open it either to provide better diagnostics or avoid dealing with exceptions. For example, this method attempts to check if path corresponds to a readable file: public static File getValidatedFile(String path...
Let's assume you have a file lyrics.txt which contains the following data: summer has come and passed the innocent can never last wake me up when september ends Read the entire file at a time By using file:read_file(File), you can read the entire file. It's an atomic operation: 1> file:re...
Write one line at a time Open a file with write mode and use io:format/2: 1> {ok, S} = file:open("fruit_count.txt", [write]). {ok,<0.57.0>} 2> io:format(S, "~s~n", ["Mango 5"]). ok 3> io:format(S, "~s~n", ["Olive 12"]). ok 4&gt...
There are no build-in methods for intersection and difference in Sets, but you can still achieve that but converting them to arrays, filtering, and converting back to Sets: var set1 = new Set([1, 2, 3, 4]), set2 = new Set([3, 4, 5, 6]); const intersection = new Set(Array.from(set1).filter(x...
Suppose you have a pojo class Person public class Person { public String name; public Person(String name) { this.name = name; } } And you want to parse it into a JSON array or a map of Person objects. Due to type erasure you cannot construct classes of List<Person&g...
If we have a file called Business.hs, we can define a Business module that can be import-ed, like so: module Business ( Person (..), -- ^ Export the Person type and all its constructors and field names employees -- ^ Export the employees function ) where -- begin types, function defin...
Haskell supports importing a subset of items from a module. import qualified Data.Stream (map) as D would only import map from Data.Stream, and calls to this function would require D.: D.map odd [1..] otherwise the compiler will try to use Prelude's map function.
When multiple modules define the same functions by name, the compiler will complain. In such cases (or to improve readability), we can use a qualified import: import qualified Data.Stream as D Now we can prevent ambiguity compiler errors when we use map, which is defined in Prelude and Data.Stre...
To concatenate the value of two or more variables into a single string and print it as the output, we need to make use of interpolation. The following Less code, #demo:after { @var1: Hello; @var2: World!!!; content: "@{var1} @{var2}"; } when compiled would set "Hello Wo...
The default font formatting provided by the fillText and strokeText methods isn't very aesthetically appealing. Fortunately the canvas API provides properties for formatting text. Using the font property you can specify: font-style font-variant font-weight font-size / line-height font-family...

Page 242 of 457