So the good news is that Apple kindly includes a Ruby interpreter. Unfortunately, it tends not to be a recent version:
$ /usr/bin/ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
If you have Homebrew installed, you can get the latest Ruby with:
$ brew install ruby...
This example show you how you add new sounds to your MOD and play them. First of all you need a sound file which has the format *.ogg. Any other format is not allowed by the Minecraft application and will be rejected.
The soundfile has the name: sound1.ogg
Put the sound file under the following pa...
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...
display dialog "Password" default answer ""
set w to text returned of the result
if w = "Password" then
display notification "Correct"
end if
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 ...
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...
Protractor Installation and Setup
Step 1: Download and install NodeJS from here. Make sure you have latest version of node. Here, I am using node v7.8.0. You will need to have the Java Development Kit(JDK) installed to run selenium.
Step 2: Open your terminal and type in the following command to i...
Let us create a simple Hello World console application and log something to the console using log4net. Once we have this running, we can scale it out to use it in real development scenarios in the following examples. Let's start small and build it up from there.
First, we need to create a simple Co...
Suppose you need to work on three different projects project A, project B and project C. project A and project B need python 3 and some required libraries. But for project C you need python 2.7 and dependent libraries.
So best practice for this is to separate those project environments. To create v...