Tutorial by Examples: c

These functions will hash either String or Data input with one of eight cryptographic hash algorithms. The name parameter specifies the hash function name as a String Supported functions are MD5, SHA1, SHA224, SHA256, SHA384 and SHA512 This example requires Common Crypto It is necessary to h...
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...
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...
The recommended approach would be to avoid doing so and rather use IOptions<TOptions> and IServiceCollection.Configure<TOptions>. That said, this is still pretty straightforward to make IConfigurationRootavailable application wide. In the Startup.cs constructor you should have the foll...
public class TestngAnnotation { // test case 1 @Test public void testCase1() { System.out.println("in test case 1"); } // test case 2 @Test public void testCase2() { System.out.println("in test case 2"); } @BeforeMethod pu...
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...
If you want an avatar to appear on the card, use the <md-card-avatar> directive, which must be placed within the <md-card-header> directive. The <md-card-avatar> directive accepts an <img /> tag. Optional: .md-user-avatar, which makes the <img /> tag have a circle look...
<git command="clone"> <args> <arg value = "-v" /> <arg value = "git@YOURGITURL:GITUSER/GITREPO" /> <arg value = "repo" /> </args> </git>
<input message="Commit message" addproperty="commit-message" /> <git command="add"> <args> <arg value="." /> </args> </git> <git command="commit"> <args> ...
std::any an_object{ std::string("hello world") }; if (an_object.has_value()) { std::cout << std::any_cast<std::string>(an_object) << '\n'; } try { std::any_cast<int>(an_object); } catch(std::bad_any_cast&) { std::cout << "Wrong type...
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 | +-------...
To sort this table Employee by department, you would use ORDER BY Department. However, if you want a different sort order that is not alphabetical, you have to map the Department values into different values that sort correctly; this can be done with a CASE expression: NameDepartmentHasanITYusufHR...
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...
Takes an array of information to generate the CAPTCHA as input and creates the image to your specifications, returning an array of associative data about the image. [array] ( 'image' => IMAGE TAG 'time' => TIMESTAMP (in microtime) 'word' => CAPTCHA WORD ) The "imag...
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 641 of 826