Tutorial by Examples

In this example we are going to implement spring-data-elasticsearch project to store POJO in elasticsearch. We will see a sample maven project which does the followings: Insert a Greeting(id, username, message) item on elasticsearch. Get All Greeting items which have been inserted. Update a Gr...
In this example we are going to see a maven based spring boot application which integrates spring-data-elasticsearch. Here, we will do the followings and see the respective code segments. Insert a Greeting(id, username, message) item on elasticsearch. Get all items from elasticsearch Update a s...
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...
simple.action.ts import { Action } from '@ngrx/store'; export enum simpleActionTpye { add = "simpleAction_Add", add_Success = "simpleAction_Add_Success" } export class simpleAction { type: simpleActionTpye constructor(public payload: number) { } } ...
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

Page 1333 of 1336