Skip to main content

Posts

Setup Asterisk 13 with FreePBX 13 in CentOS 7

Launch CentOS 7 AWS Ec2 InstanceLog in to your aws consoleGo to ec2 management page and click Launch Instance on Instance pageIn Choose AMI step, go to AWS MarketPlace tab and search CentOS 7 on search field. List of centos 7 ami's will be available.Select CentOS 7 (x86_64) ami which is free tier eligible. Select your instance type and click configure instance. Keep default values from Configure Instance to Add Tags stepsIn configure security group, create a security group which allow minimum ports openSSH : port 22HTTP : port 80Custom UDP Rule : 10000-20000 (if you are giving RTP ports 10000-20000)Custom UDP Rule : 5060 (ChanSIP port)Custom TCP Rule : 5060 (ChanSIP Port)Click Launch Instance. Select your key file and accept terms to launch instance.
Setup CentOS Server SSH into newly created CentOS server with username centos and your key file.Update all existing packagessudo yum update -yNow start http service(you can access your server via browser by going to your server ip addres…
Recent posts

Start an android activity from cordova plugin

We all need to start an android activity from a cordova plugin. Here is a small and complete code to start an activity from cordova plugin
1. Install plugman to create cordova plugin npm install -g plugman2. Create cordova plugin using plugman plugman create --name PluginName --plugin_id com.example.sample.plugin --plugin_version 0.0.1
N.B : plugin id never start with Uppercase Now PluginName directory will be created. Plugin structure will be
> PluginName/

> |- plugin.xml

> |- src/

> |- www/PluginName.js

3. Add android platform to plugin
plugman platform add --platform_name android Now plugin structure will be

> PluginName/

> |- plugin.xml

> |- src/android/PluginName.java

> |- www/PluginName.js

4. Now create a java file named NewActivity.java in src/android diretory
This activity will be shown using our plugin. Write sample activity in NewActivity.java
package com.example.sample.plugin;

import android.app.Activity;
import android.os.Bundle;

public…

Redirect web url to a specific directory using apache

As i am a developer, i have many scenarios where many project will be in a single server but we have different web url. So we need to redirect the http control to a specific project directory based on our web url.

          For example, example.com code is located in  /var/www/html/home while sub.example.com code at /var/www/html/sub directory. This can be done using apache in ubuntu.

Execute below commands to redirect redirect sub.example.com to respective directory.

cd /etc/apache2/sites-available
Now create a conf file named with your url, for example sub.example.conf and add below code to that file,

<VirtualHost *:80>
    ServerName sub.example.com
    DocumentRoot /var/www/html/sub
    <Directory /var/www/html/sub>
        AllowOverride All
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save this file and execute below commands sudo a2ensite sub.example.conf
sudo a2enmod rewrite
s…

Build List on scroll - Jquery

Now a days, we have many websites including social networking and commercial sites dynamically building the list based on our scroll. Here i am showing how to build list based on our scrolling in a whole div and on a specific div.

    First of all, we need to write a server side script to give front-end required list. In my example, i am creating ajax.php

<?php
$image_path="images";
$details=array(
array("Amazon", $image_path."/amazon.png"),
array("Apple", $image_path."/apple.png"),
array("Cisco", $image_path."/cisco.png"