The problem statement is like if we are given two string str1 and str2 then how many minimum number of operations can be performed on the str1 that it gets converted to str2.The Operations can be:
Insert
Remove
Replace
For Example
Input: str1 = "geek", str2 = "gesek"
Ou...
In order to trigger a "upgradeneeded" event you need to request the database with version higher than the current version - otherwise the event won't be triggered.
function createTable(dbName, dbversion, tableName) {
var request = indexedDB.open(dbName, dbversion);
request.onupgrade...
This is a more generic solution applicable in system where the user has option to add indexes to the table that he uses:
function createTable(dbName, tableName) {
var request = indexedDB.open(dbName);
request.onsuccess = function (e){
var database = e.target.result;
var version = p...
Node js code
Sample to start this topic is Node.js server communicating with Arduino via serialport.
npm install express --save
npm install serialport --save
Sample app.js:
const express = require('express');
const app = express();
var SerialPort = require("serialport");
var po...
Suppose we have this source file that we would like to split:
cat -n sourcefile
1 On the Ning Nang Nong
2 Where the Cows go Bong!
3 and the monkeys all say BOO!
4 There's a Nong Nang Ning
5 Where the trees go Ping!
6 And the tea pots jibber jabber joo.
7 On the Nong Ning Nang
Comma...
Almost usually things are a little bit more complex and to support scalability we should split things apart. So we can define various files containing different resources dictionaries, i.e. resources for UI controls' themes, resources for texts and so on, then we merge them all together in App.xaml ...
The goal of backpropagation is to optimize the weights so that the neural network can learn how to correctly map arbitrary inputs to outputs.
Each layer has its own set of weights, and these weights must be tuned to be able to accurately predict the right output given input.
A high level overview ...
Activation functions also known as transfer function is used to map input nodes to output nodes in certain fashion.
They are used to impart non linearity to the output of a neural network layer.
Some commonly used functions and their curves are given below:
Sigmoid Function
The sigmoid is a ...
Softmax regression (or multinomial logistic regression) is a generalization of logistic regression to the case where we want to handle multiple classes. It is particularly useful for neural networks where we want to apply non-binary classification. In this case, simple logistic regression is not suf...
from urllib.request import urlopen
from collections import Counter
import re
conn = urlopen('http://textfiles.com/100/dodontae.hum')
lines = conn.readlines()
conn.close()
# readlines() returns byte strings
data = ''.join([line.decode('utf-8') for line in lines])
# replace non-letters ...
Enter command "tsc --init" and hit enter.
Before that we need to compile ts file with command "tsc app.ts" now it is all defined in below config file automatically.
Now, You can compile all typescripts by command "tsc". it will automatically create ".js&q...
public void setCardColorTran(CardView card) {
ColorDrawable[] color = {new ColorDrawable(Color.BLUE), new ColorDrawable(Color.RED)};
TransitionDrawable trans = new TransitionDrawable(color);
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
card.setB...
public void setCardColorTran(View view) {
ColorDrawable[] color = {new ColorDrawable(Color.BLUE), new ColorDrawable(Color.RED)};
TransitionDrawable trans = new TransitionDrawable(color);
if(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
view.setBackgrou...
This module register hello function on hello module. hello function prints Hello world on console with printf and return 1373 from native function into javascript caller.
#include <node_api.h>
#include <stdio.h>
napi_value say_hello(napi_env env, napi_callback_info info)
{
n...
Gui, +AlwaysOnTop +Disabled -SysMenu +Owner ; +Owner avoids a taskbar button.
Gui, Add, Text,, Some text to display.
Gui, Show, NoActivate, Title of Window ; NoActivate avoids deactivating the currently active window.
As already mentioned you can declare an unordered map of any type. Let's have a unordered map named first with string and integer type.
unordered_map<string, int> first; //declaration of the map
first["One"] = 1; // [] operator used to insert the value
first["Two"] = 2...
unordered_map<data_type, data_type> variable_name; //declaration
variable_name[key_value] = mapped_value; //inserting values
variable_name.find(key_value); //returns iterator to the key value
variable_name.begin(); // iterator to the first element
variable_name.end(); // iterator t...
The following steps need to be done in the app.ionic.io
Create an account or login into your ionic account
Click "New App" in the Dashboard and give name for your app
I named my app as 'MyIonicApp'
In the overview section of this newly created app, there will be a ID...