R-markdown code chunks
R-markdown is a markdown file with embedded blocks of R code called chunks. There are two types of R code chunks: inline and block.
Inline chunks are added using the following syntax:
`r 2*2`
They are evaluated and inserted their output answer in place.
Block chunks hav...
1)First go through Paypal Developer web site and create an application.
2)Now open your manifest file and give the below permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"...
The getForObject and getForEntity methods of RestTemplate load the entire response in memory. This is not suitable for downloading large files since it can cause out of memory exceptions. This example shows how to stream the response of a GET request.
RestTemplate restTemplate // = ...;
// Optio...
Preemptive basic authentication is the practice of sending http basic authentication credentials (username and password) before a server replies with a 401 response asking for them. This can save a request round trip when consuming REST apis which are known to require basic authentication.
As descr...
Phalcon uses db service by default to obtain connection to databases.
Assuming you have an conguration file with database field set up, you can include or autoload following code to obtain connection with database for your project:
$di->set('db', function () use ($config) {
$dbconf = $conf...
<?php
//Create a new SQLite3 object from a database file on the server.
$database = new SQLite3('mysqlitedb.db');
//Query the database with SQL
$results = $database->query('SELECT bar FROM foo');
//Iterate through all of the results, var_dumping them onto the page
while ($row = $resu...
In addition to using LIMIT SQL statements you can also use the SQLite3 function querySingle to retrieve a single row, or the first column.
<?php
$database = new SQLite3('mysqlitedb.db');
//Without the optional second parameter set to true, this query would return just
//the first column of ...
Using core debugger
Node.js provides a build in non graphical debugging utility. To start the build in the debugger, start the application with this command:
node debug filename.js
Consider the following simple Node.js application contained in the debugDemo.js
'use strict';
function addTwoN...
The main reason that Nightwatch is so powerful, is because of it's excellent configuration file. Unlike most other testing frameworks, Nightwatch is fully configurable and customizable to different environments and technology stacks.
.meteor/nightwatch.json
The following configuration file is for...
In the root of your application should be a package.json file, where you can define scripts and devDependencies.
{
"name": "myapp",
"version": "1.0.0",
"scripts": {
"start": "meteor --settings settings-development.json&q...
A basic Nightwatch installation for Meteor will have the following directories and files installed.
/myapp
/myapp/.meteor/nightwatch.json
/client/main.html
/client/main.js
/client/main.css
/tests
/tests/nightwatch
/tests/nightwatch/assertions
/tests/nightwatch/commands
/tests/nightwatch/da...
Nightwatch accepts a second globals.json configuration file which injects data into the test runner itself, very similar to how Meteor.settings makes data from the command line available throughout the app.
globals.json
{
"default" : {
"url" : "http://localhost:300...
Readable streams can be "piped," or connected, to writable streams. This makes data flow from the source stream to the destination stream without much effort.
var fs = require('fs')
var readable = fs.createReadStream('file1.txt')
var writable = fs.createWriteStream('file2.txt')
rea...
The first part of this example explains how to implement it. In the second, I will explain how it works. This tries to be a general example. The template for the map (see step 3) and the example functions are fully customizable.
################################# IMPLEMENTATION #####################...
Helpers should extend from Mage_Core_Helper_Abstract:
# File: app/code/local/Vendor/Package/Helper/Data.php
class Vendor_Package_Helper_Data extends Mage_Core_Helper_Abstract
{
public function multiply($a, $b)
{
return $a * $b;
}
}
To be able to access is via Mage::hel...
Use the annotation -- @FixMethodOrder(MethodSorters.DEFAULT). This runs all tests within the class in a deterministic and somewhat predictable order. The implementation hashes the method names and compares them. In the scenario of a tie, it sorts by lexicographical order.
Code Segment Below Taken f...
Use the annotation @FixMethodOrder with the method sorter MethodSorters.NAME_ASCENDING. This will run all tests within the class in a deterministic and predictable order. The implementation compares the method names and in the case of a tie, it compares the methods' toString().
Code Segment Below T...
Radio Buttons allow you to let the user choose one element of those given. There are two ways to declare a RadioButton with a text besides it. Either by using the default constructor RadioButton() and setting the text with the setText(String) method or by using the other constructor RadioButton(Stri...