Tutorial by Examples: c

Consider this example function to check if a host is up: is_alive() { ping -c1 "$1" &> /dev/null } This function sends a single ping to the host specified by the first function parameter. The output and error output of ping are both redirected to /dev/null, so the functi...
Decorator is one of structural design patterns. It is used to add, remove or change behaviour of object. This document will teach you how to use Decorator DP properly. Let me explain the idea of it to you on a simple example. Imagine you're now in Starbobs, famous coffee company. You can place an o...
Comments in Sass vs. Scss are largely similar, except when multi-lines are concerned. SASS multi-lines are indentation-sensitive, while SCSS relies on comment terminators. Single-Line Comment style.scss // Just this line will be commented! h1 { color: red; } style.sass // Exactly the same ...
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...
IRB means "Interactive Ruby Shell", letting us execute ruby expressions from the standart input. To start, type irb into your shell. You can write anything in Ruby, from simple expressions: $ irb 2.1.4 :001 > 2+2 => 4 to complex cases like methods: 2.1.4 :001> def method ...
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...
The class use Phalcon\Validation\Validator; use Phalcon\Validation\ValidatorInterface; use Phalcon\Validation\Message; class RecaptchaValidator extends Validator implements ValidatorInterface { public function validate(\Phalcon\Validation $validation, $attribute) { $value =...
Things you need A paid Apple Developer Program Membership A valid App ID and identifier for you app (like com.example.MyApp) which is not used before anywhere Access to developer.apple.com and Member Center An iOS Device to test (as Push Notifications don't work on Simulator) Enabling t...
You can find description of the driver here. The quick example is: import psycopg2 db_host = 'postgres.server.com' db_port = '5432' db_un = 'user' db_pw = 'password' db_name = 'testdb' conn = psycopg2.connect("dbname={} host={} user={} password={}".format( ...
An extremely simple tool for installing PostgreSQL on a Mac is available by downloading Postgres.app. You can change preferences to have PostgreSQL run in the background or only when the application is running.
In order to determine some simple statistics of a value in a column of a table, you can use an aggregate function. If your individuals table is: NameAgeAllie17Amanda14Alana20 You could write this statement to get the minimum, maximum and average value: SELECT min(age), max(age), avg(age) FROM i...
C++ compilers encode additional information in the names of exported functions, such as argument types, to make overloads with different arguments possible. This process is called name mangling. This causes problems with importing functions in C# (and interop with other languages in general), as the...
There're several conventions of calling functions, specifying who (caller or callee) pops arguments from the stack, how arguments are passed and in what order. C++ uses Cdecl calling convention by default, but C# expects StdCall, which is usually used by Windows API. You need to change one or the ot...
foo = "bar" foo[0] = "c" # Error Immutable variable value can not be changed once they are created.
In Solution Explorer go to your project, right click on References then Add reference… Search for Compression and select System.IO.Compression.FileSystem then press OK. Add Imports System.IO.Compression to the top of your code file (before any class or module, with the other Imports statements)....
Windows in SFML are represented by one of two classes: sf::Window is a generic window provided by the operating system including an OpenGL render context. sf::RenderWindow is a specialized version of sf::Window that also acts as a sf::RenderTarget, allowing SFML's primitives to be rendered to it...
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> ...
On systems that use the System-V style init scripts, such as RHEL/CentOS 6: service <service> status On systems using systemd, such as Ubuntu (Server and Desktop) >= 15.04, and RHEL/CentOS >= 7.0: systemctl status <service>
On systems using systemd, such as Fedora => 15, Ubuntu (Server and Desktop) >= 15.04, and RHEL/CentOS >= 7: systemctl status [servicename] ...where [servicename] is the service in question; for example, systemctl status sshd. This will show basic status information and any recent errors ...

Page 406 of 826