Run the following bash script as sudo
#!/bin/bash
# get deps
apt -y install build-essential libncurses5-dev libxml2-dev libsqlite3-dev libssl-dev libsrtp0-dev uuid-dev libjansson-dev
# download
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz...
Ex1:-
let str1 = 'stackoverflow';
let str2 = 'flowerovstack';
These strings are anagrams.
// Create Hash from str1 and increase one count.
hashMap = {
s : 1,
t : 1,
a : 1,
c : 1,
k : 1,
o : 2,
v : 1,
e : 1,
r : 1,
f : 1,
l : 1,
w : 1...
(function(){
var hashMap = {};
function isAnagram (str1, str2) {
if(str1.length !== str2.length){
return false;
}
// Create hash map of str1 character and increase value one (+1).
createStr1HashMap(str1);
/...
You get this exception mostly with form submissions. Laravel protects application from CSRF and validates every request and ensures the request originated from within the application. This validation is done using a token. If this token mismatches this exception is generated.
Quick Fix
Add this wi...
ForeignKey field is used to create a many-to-one relationship between models.
Not like the most of other fields requires positional arguments.
The following example demonstrates the car and owner relation:
from django.db import models
class Person(models.Model):
GENDER_FEMALE = 'F'
G...
Solves problem of: access denied for user root using password YES
Stop mySQL:
sudo systemctl stop mysql
Restart mySQL, skipping grant tables:
sudo mysqld_safe --skip-grant-tables
Login:
mysql -u root
In SQL shell, look if users exist:
select User, password,plugin FROM mysql.user ;
U...
Fugitive Vim is a plugin by Tim Pope that provides access to git commands that you can execute without leaving vim.
Some common commands include:
:Gedit - edit a file in the index and write it to stage the the changes
:Gstatus - equivalent of git status
:Gblame - brings up vertical split of outp...
display dialog "Password" default answer ""
set w to text returned of the result
if w = "Password" then
display notification "Correct"
end if
CREATE INDEX ord_customer_ix ON orders (customer_id);
By default, if we do not mention anything, oracle creates an index as a b-tree index. But we should know when to use it.
B-tree index stores data as binary tree format. As we know that, index is a schema object which stores some sort of entry...
CREATE BITMAP INDEX
emp_bitmap_idx
ON index_demo (gender);
Bitmap index is used when data cardinality is low.
Here, Gender has value with low cardinality. Values are may be Male, Female & others.
So, if we create a binary tree for this 3 values while searching it will have unnecessary ...
CREATE INDEX first_name_idx ON user_data (UPPER(first_name));
SELECT *
FROM user_data
WHERE UPPER(first_name) = 'JOHN2';
Function based index means, creating index based on a function.
If in search (where clause), frequently any function is used, it's better to create index based on ...
NERD TREE is a plugin by scrooloose that allows you to explore the file system while using vim. You can open files and directories via a tree system that you can manipulate with the keyboard or the mouse.
Add this to your .vimrc to start NERDTree automatically when vim starts up:
autocmd vimenter...
Working with Kettle
There are two versions of Kettle aka Pentaho Data Integration :
Kettle CE (Community Edition)
Kettle EE (Enterprise Edition)
Documents aims mainly on Kettle CE edition.
Prerequisites
PDI requires the Oracle Java Runtime Environment (JRE) version 7. You can obtain a JRE ...
var MongoClient = require('mongodb').MongoClient;
//connection with mongoDB
MongoClient.connect("mongodb://localhost:27017/MyDb", function (err, db) {
//check the connection
if(err){
console.log("connection failed.");
}else{
...
The NamedParameterJdbcTemplate class adds support for programming
JDBC statements using named parameters, as opposed to programming JDBC
statements using only classic placeholder ( '?') arguments. The
NamedParameterJdbcTemplate class wraps a JdbcTemplate, and
delegates to the wrapped JdbcTempl...
Any @Component or @Configuration could be marked with @Profile annotation
@Configuration
@Profile("production")
public class ProductionConfiguration {
// ...
}
The same in XML config
<beans profile="dev">
<bean id="dataSource" class="&l...