Tutorial by Examples: a

Add Stripe gem to our Gemfile gem 'stripe' Add initializers/stripe.rb file. This file contains the necessary keys for connecting with your stripe account. require 'require_all' Rails.configuration.stripe = { :publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'], :secret_key =&g...
ArrayList<String> fontNames = new ArrayList<String>(); File temp = new File("/system/fonts/"); String fontSuffix = ".ttf"; for(File font : temp.listFiles()) { String fontName = font.getName(); if(fontName.endsWith(fontSuffix)) { fontNames.add(f...
In the following code you need to replace fontsname by the name of the font you would like to use: TextView lblexample = (TextView) findViewById(R.id.lblexample); lblexample.setTypeface(Typeface.createFromFile("/system/fonts/" + "fontsname" + ".ttf"));
Detailed instructions on getting magento-1.9 set up or installed.
Incrementing an invoice number and saving its value is a frequent task. Using CustomDocumentProperties (CDPs) is a good method to store such numbers in a relatively safe way within the same work book, but avoiding to show related cell values simply in an unprotected work sheet. Additional hint: A...
The configuration to make a secure connection using express.js (Since version 3): var fs = require('fs'); var http = require('http'); var https = require('https'); var privateKey = fs.readFileSync('sslcert/server.key', 'utf8'); var certificate = fs.readFileSync('sslcert/server.crt', 'utf8'); ...
First of all, we will need to create our Dockerfile. A good example can be found on this blog by Nick Janetakis. This code contains the script that will be executed on our docker machine at the moment of start.For this reason, we are installing all the required libraries and ends with the start of ...
it can happen that you use a scanner with the System.in as parameter for the constructor, then you need to be aware that closing the scanner will close the InputStream too giving as next that every try to read the input on that (Or any other scanner object) will throw an java.util.NoSuchElementExcep...
To remote tracking between local and deleted remote branches use git fetch -p you can then use git branch -vv to see which branches are no longer being tracked. Branches that are no longer being tracked will be in the form below, containing 'gone' branch 12345e6 [origin/bran...
The following method will take a second or two depending on your connection to retrieve a web page and count the text length. Whatever thread calls it will block for that period of time. Also it rethrows an exception which is useful later on. public static long blockingGetWebPageLength(String urlS...
Create a tag: To create a tag on your current branch: git tag < tagname > This will create a local tag with the current state of the branch you are on. To create a tag with some commit: git tag tag-name commit-identifier This will create a local tag with the commit-identifier...
In the example below, the calculateShippingPrice method calculates shipping cost, which takes some processing time. In a real world example, this would e.g. be contacting another server which returns the price based on the weight of the product and the shipping method. By modeling this in an async ...
This example requires importing DateAdapter. import {DateAdapter} from '@angular/material'; datepicker.component.html: <md-input-container> <input mdInput [mdDatepicker]="picker" placeholder="Choose a date"> <button mdSuffix [mdDatepickerToggle]="pi...
mView.afterMeasured { // inside this block the view is completely drawn // you can get view's height/width, it.height / it.width } Under the hood inline fun View.afterMeasured(crossinline f: View.() -> Unit) { viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlob...
(from official doc) fun main(args: Array<String>) { launch(CommonPool) { // create new coroutine in common thread pool delay(1000L) // non-blocking delay for 1 second (default time unit is ms) println("World!") // print after delay } println("He...
Glide .with(context) .load(currentUrl) .into(new BitmapImageViewTarget(profilePicture) { @Override protected void setResource(Bitmap resource) { RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(context.g...
git diff-tree --no-commit-id --name-only -r COMMIT_ID
Automatic routing for the DRF, can be achieved for the ViewSet classes. Assume that the ViewSet class goes by the name of MyViewSet for this example. To generate the routing of MyViewSet, the SimpleRouter will be utilized. On myapp/urls.py: from rest_framework import routers router = ...
Please note that some terms like JIT and GC are generic enough to apply to many programming language environments and runtimes. CLR: Common Language Runtime IL: Intermediate Language EE: Execution Engine JIT: Just-in-time compiler GC: Garbage Collector OOM: Out of memory STA: Single-threaded ...
Suppose you’ve got a lot of commit against a project (here ulogd2, official branch is git-svn) and that you wan to send your patchset to the Mailling list [email protected]. To do so, just open a shell at the root of the git directory and use: git format-patch --stat -p --raw --signoff --subject...

Page 1096 of 1099