Tutorial by Examples: and

ssh -p 21 [email protected] <<EOF echo 'printing pwd' echo "\$(pwd)" ls -a find '*.txt' EOF $ is escaped because we do not want it to be expanded by the current shell i.e $(pwd) is to be executed on the remote shell. Another way: ssh -p 21 [email protected] <...
sudo -s <<EOF a='var' echo 'Running serveral commands with sudo' mktemp -d echo "\$a" EOF $a needs to be escaped to prevent it to be expanded by the current shell Or sudo -s <<'EOF' a='var' echo 'Running serveral commands with sudo' mktemp -d e...
Inside your layout, add a Login button with the following code: <com.twitter.sdk.android.core.identity.TwitterLoginButton android:id="@+id/twitter_login_button" android:layout_width="wrap_content" android:layout_height="wrap_content" and...
Each time this parameter is referenced, a random integer between 0 and 32767 is generated. Assigning a value to this variable seeds the random number generator (source). ~> $ echo $RANDOM 27119 ~> $ echo $RANDOM 1349
On systems that use the System-V style init scripts, such as RHEL/CentOS 6: service <service> start service <service> stop On systems using systemd, such as Ubuntu (Server and Desktop) >= 15.04, and RHEL/CentOS >= 7: systemctl <service> dnsmasq systemctl <service> ...
You can combine named arguments with optional parameters. Let see this method: public sealed class SmsUtil { public static bool SendMessage(string from, string to, string message, int retryCount = 5, object attachment = null) { // Some code } } When you want to call t...
Date and time without time zone information LocalDateTime dateTime = LocalDateTime.of(2016, Month.JULY, 27, 8, 0); LocalDateTime now = LocalDateTime.now(); LocalDateTime parsed = LocalDateTime.parse("2016-07-27T07:00:00"); Date and time with time zone information ZoneId zoneId = Zon...
LocalDate tomorrow = LocalDate.now().plusDays(1); LocalDateTime anHourFromNow = LocalDateTime.now().plusHours(1); Long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(LocalDate.now(), LocalDate.now().plusDays(3)); // 3 Duration duration = Duration.between(Instant.now(), ZonedDateTime.par...
The revert command allows discarding unwanted uncommitted changes. Reverting changes to a single file. hg revert example.c Reverting all changes. This will discard all changes not just the current directory. hg revert --all hg will output which files were reverted. reverting exa...
In C++ methods that differs only by const qualifier can be overloaded. Sometimes there may be a need of two versions of getter that return a reference to some member. Let Foo be a class, that has two methods that perform identical operations and returns a reference to an object of type Bar: class ...
To list files and folders inside current directory, we use ls command: user@host:/$ ls bin boot cdrom dev etc home initrd.img lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var vmlinuz ls prints folder structure in simple view, color coded by type....
During mousemove you get flooded with 30 mouse events per second. You might not be able to redraw your drawings at 30 times per second. Even if you can, you're probably wasting computing power by drawing when the browser is not ready to draw (wasted == across display refresh cycles). Therefore it m...
The even? method can be used to determine if a number is even 4.even? # => true 5.even? # => false The odd? method can be used to determine if a number is odd 4.odd? # => false 5.odd? # => true
Invented by John McCarthy around 1958, Lisp (List Processor) has continued to grow into an entire family of languages. Since StackOverflow is more about practical programming problems, typically problems will involve actual Lisp dialects or derived languages and their implementations. Problems that...
Let's take a sample class: public class Transaction { public string Category { get; set; } public DateTime Date { get; set; } public decimal Amount { get; set; } } Now, let us consider a list of transactions: var transactions = new List<Transaction> { new Transaction...
UISplitViewController must be the rootViewController of your application. AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] i...
Pair allows us to treat two objects as one object. Pairs can be easily constructed with the help of template function std::make_pair. Alternative way is to create pair and assign its elements (first and second) later. #include <iostream> #include <utility> int main() { std::p...
GNU Emacs uses a special format for documentation: info. The Common Lisp standard has been converted to the Texinfo format, which can be used to create documentation browsable with the info reader in GNU Emacs. See here: dpans2texi.el converts the TeX sources of the draft ANSI Common Lisp standard...
The axis offsets for drawing the marker that are specified by refX and refY are applied before the rotation specified by the orient parameter. Below you can see the effects of various combinations of orient and refX, refY to illustrate this. <svg width="800px" height="600px"&...
Elements can specify start, mid and end markers separately. Below are examples of start, mid and end markers for all elements that can be marked. Please note that Chrome does not currently (July 2016) calculate auto orientation correctly for start and end markers for polygons (bug# 633012), and also...

Page 74 of 153