Tutorial by Examples: l

Python allows you to hack list comprehensions to evaluate conditional expressions. For instance, [value_false, value_true][<conditional-test>] Example: >> n = 16 >> print [10, 20][n <= 15] 10 Here n<=15 returns False (which equates to 0 in Python). So what Python i...
SystemJS allows to write and use modular javacsript code that relies on ECMAScript 6 import and export statements. One good example is moment.js library, which started publishing ECMAScript 6 source code on npm since 2.10.0 release of moment.js. Installing prerequisites npm install moment npm ins...
var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var app = express(); app.use(favicon(__dirname + '/public/img/favicon.ico')); app.use(express.static(path.join(__dirname, 'public'))); app.listen(3000, function() { console.log("...
var express = require('express'); var app = express(); var router = express.Router(); app.route('/user') .get(function (req, res) { res.send('Get a random user') }) .post(function (req, res) { res.send('Add a user') }) .put(function (req, res) { res.send...
Install Java 8 from the Oracle website. (Optional) Install a Java build tool. Whether you choose to use Maven or Gradle, you normally don’t have to install anything, as JHipster will automatically install the Maven Wrapper or the Gradle Wrapper for you. If you don’t want to use those wrappers, ...
The simplest and cleanest way to add an external configuration is through a separate Gradle file build.gradle apply from: './keystore.gradle' android{ signingConfigs { release { storeFile file(keystore.storeFile) storePassword keystore.storePassword ...
To debug a server instance, start in debug mode. To do so, configure these parameters to be passed to the server: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n to setenv.bat(Windows) or setenv.sh(Unix) These initialize the server in debug mode, and listen for debug reque...
Using more than one theme in your Android application, you can add custom colors to every theme, to be like this: First, we have to add our themes to style.xml like this: <style name="OneTheme" parent="Theme.AppCompat.Light.DarkActionBar"> </style> <!--...
Obtaining the Android API Key : First you'll need to get the SHA-1 fingerprint on your machine using java keytool. Execute the below command in cmd/terminal to get the SHA-1 fingerprint. keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android...
<git command="clone"> <args> <arg value = "-v" /> <arg value = "git@YOURGITURL:GITUSER/GITREPO" /> <arg value = "repo" /> </args> </git>
<git command = "pull" dir = "repository_path" />
1) Setup Node.JS Start the terminal and run the following commands to install nodeJS: curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - sudo apt-get install nodejs If node command is unavailable sudo ln -s /usr/bin/nodejs /usr/bin/node Alternatives NodeJS instalations: curl...
18.0 By default, any function specified in a -callback directive in a behaviour module must be exported by a module that implements that behaviour. Otherwise, you'll get a compiler warning. Sometimes, you want a callback function to be optional: the behaviour would use it if present and exported,...
Suppose that we have a text and a pattern. We need to determine if the pattern exists in the text or not. For example: +-------+---+---+---+---+---+---+---+---+ | Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | +-------+---+---+---+---+---+---+---+---+ | Text | a | b | c | b | c | g | l | x | +-------...
Entity falling distance is the distance the entity have fallen without reaching a block. It can be used to calculate different damage from falling, or activating an effect after a big fall. Retrieving the falling distance float distanceFell = entity.getFallingDistance(); Setting the falling ...
Follow the below steps to install Oracle JDK from the latest tar file: Download the latest tar file from here - Current latest is Java SE Development Kit 8u112. You need sudo privilages: sudo su Create a dir for jdk install: mkdir /opt/jdk Extract downloaded tar into it: t...
You can cancel a fall damage by using the EntityDamageEvent @EventHandler public void onEntityDamage(EntityDamageEvent e) { Entity tookDamage = e.getEntity(); DamageCause cause = e.getCause(); if (cause == DamageCause.FALL){ //Damage was caused by falling, cancel it e.setCancelled(t...
If you find that no matter what you put in your URL only your default page is loading, it might be that your server does not support the PATH_INFO variable needed to serve search-engine friendly URLs. As a first step, open your application/config/config.php file and look for the URI Protocol inform...
This helper is loaded using the following code: In Controller itself(* can repeat again and again*) $this->load->helper('captcha'); In config/autoload.php (Load only once) $autoload['helper'] = array('captcha');
Once loaded you can generate a captcha like this: $vals = array( 'word' => 'Random word', 'img_path' => './captcha/', 'img_url' => 'http://example.com/captcha/', 'font_path' => './path/to/fonts/texb.ttf', 'img_width' => '150', 'img_height'...

Page 654 of 861