Wednesday, February 8, 2017

GUI version control for Linux system

RabbitVCS 

TortoiseSVN alternative for Linux is RabbitVCS.  

Install RabbitVCS in Ubuntu

RabbitVCS screenshot

Sure, you can always work with SVN repositories from the command line but sometimes a graphical SVN client is more convenient - for example you can use it to check which files are not added to the repository yet. And when it comes to graphical SVN clients, I'm sure most of you will agree when I say that RabbitVCS, a "set of graphical tools written to provide simple and straightforward access to the version control systems you use" inspired by the famous TortoiseSVN, is probably the best such tool for Linux.


RabbitVCS gedit
(RabbitVCS Gedit plugin)


Not just for SVN / Nautilus


RabbitVCS has most of the TortoiseSVN features and nicely integrates into the GNOME desktop thanks to a Nautilus Extension and a Gedit plugin for easy access to everything you need. Further more, even though its main page doesn't mention this, RabbitVCS is not just for Nautilus / SVN! It works with GIT (starting with version 0.14, released on January 4th, 2011) too and it also has a Thunar plugin so you can use it under XFCE too.



RabbitVCS


Those of you who haven't tried Rabbitvcs lately will be glad to know that since version 0.14.1.1 things became quite stable and Nautilus now stays responsive while the plugin checks for changes in the background. In fact, the v0.14 release cycle ended and the RabbitVCS developer posted a roadmap for the v0.15 cycle which includes: recursive/async status monitor for Nautilus, RabbitVCS menu items and emblems to the Gedit file browser plugin and refactor VCS abstraction code to make it easier to add new VCSs and UIs. He needs some help with all this so if you can, help him out!


Install RabbitVCS in Ubuntu

1. Add the RabbitVCS Ubuntu PPA:
sudo add-apt-repository ppa:rabbitvcs/ppa && sudo apt-get update

2. Install RabbitVCS:

- For Nautilus 2:
sudo apt-get install rabbitvcs-core rabbitvcs-nautilus rabbitvcs-cli

- For Nautilus 3 (Ubuntu 11.10, 12.04):
sudo apt-get install rabbitvcs-core rabbitvcs-nautilus3 rabbitvcs-cli


- For Thunar:
sudo apt-get install rabbitvcs-core rabbitvcs-cli rabbitvcs-thunar

Once installed, restart Nautilus / Thunar (for Nautilus, type "nautilus -q" in a terminal).


Optional: If you also want to install the RabbitVCS Gedit extension, use the following command:
sudo apt-get install rabbitvcs-gedit




Friday, February 3, 2017

Check Mod Rewrite Enabled or not in Apache

To check either mod rewrite enabled or not in Apache

Check mod rewrite is enabled or not

1. Create sample.php file in localhost root folder with below content

print_r(apache_get_modules());

output check for mod_rewrite

2.To check .htaccess is working keep the below code in .htaccess
RewriteEngine On
RewriteRule ^.*$ test.php 

REMOTE DEBUGGING ON IOS for Ios APACHE CORDOVA and mobile webpages

Safari Remote Debug Tool



This tutorial will show you how to remotely debug your cordova app on iOS using the safari remote debug tool to inspect the java script errors .

Enable Debugging on Desktop side

First, you need to enable Safari Develop menu in Safari desktop. 
Go to Safari > Preferences and ensure the Show Develop menu in menu bar check box is checked.





Enable Debug Mode on Mobile

Now, you need to enable Web Inspector in the advanced Safari Settings of your iOS Device. Go to Settings > Safari > Advanced and enable Web Inspector.







Inspect with Safari


Now we're finally able to remotely debug our cordova webview with Safari. First, launch your app on your iOS device connected to the computer via USB. 

In Safari desktop, Go to Develop > Your iPad/iPhone > Index.html.





That's it! Now you should be able to debug your app like any other website!


Debug JavaScript Step by Step

Exactly like you would do on any website, you can remotely debug step by step your JavaScript code in the Safari Web Inspector.




Wednesday, January 25, 2017

Firebase cloud messaging Push Notification for Websites (fcm)

Getting a Configuration File


FCM FLOW
FCM FLOW




  • Now put your app name and select your country.


  • Now click on Add Firebase to Your Android App.
  • Write some code for registering the service worker
    • index.html 
      • this file is responsible to subscribe the user devices and sends the device tokens to server.
include below js file: https://www.gstatic.com/firebasejs/3.6.2/firebase.js add below script code in script tag:
 var config = {
            apiKey: "AIzaSyDaY7_6yfeMbXIQNLgrLa3n_IqweQ",
                    authDomain: "push-a1eaa.firebaseapp.com",
                    databaseURL: "https://push-a1eaa.firebaseio.com",
                    storageBucket: "push-a3eaa.appspot.com",
                    messagingSenderId: "3490973264967"
            };
            firebase.initializeApp(config);
             
 


            const messaging = firebase.messaging();
            messaging.requestPermission()
                    .then(function () {
                    console.log('Have permission');
                    return messaging.getToken();
                    })
                    .then(function (token) {
                    document.getElementById("bigone").innerHTML = token;
                    console.log(token);
                    })
                    .catch(function (err) {
                    console.log('Unable to get permission to notify.', err);
                    });


            messaging.onMessage(function (payload) {
            
            console.log("Message received. ", payload);
            });
 
    • firebase-messaging-sw.js
      include two files : https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js
      // Initialize the Firebase app in the service worker by passing in the
      // messagingSenderId.
      firebase.initializeApp({
        'messagingSenderId': '3490973264967'
      });
      
      // Retrieve an instance of Firebase Messaging so that it can handle background
      // messages.
      const messaging = firebase.messaging();
       
      
      // If you would like to customize notifications that are received in the
      // background (Web app is closed or not in browser focus) then you should
      // implement this optional method.
      // [START background_handler]
      messaging.setBackgroundMessageHandler(function(payload) {
        console.log('[firebase-messaging-sw.js] Received background message ', payload);
        // Customize notification here
        const notificationTitle = payload.notification.title;
        const notificationOptions = {
          body: payload.notification.body,
          
        };
      
        return self.registration.showNotification(notificationTitle,
            notificationOptions);
      });
      
      • this file is responsible to receive the messages from fcm and shows the notification information
  • Send Push notifications to client
    • Curl request on the server side:   
      curl "https://fcm.googleapis.com/fcm/send" --request POST --header "Authorization: key=server_key" --header "Content-Type: application/json" -d "{\"to\":\"client_token\"}"
      
      Example: URL:fcm.googleapis.com/fcm/send
      method: POST
      Authorization:key=AIzaSyDJK8dkx_7-7RdJ3YsIg_ueGFnPgOGQD0k
      {
      "notification": {
      "title": "Portugal vs. Denmark",
      "body": "5 to 1",
      "icon": "firebase-icon.png",
      "click_action": "http://localhost:8081"
      },
      "registration_ids":["eBdhRIGunJk:APA91bFVvA9XMJoXrKrgvY57wiY4tIsYJFLjW5AjgZOIZ-dRDIDxkM87eCEokvRW9jk01kyFN-
      ypGYTQ_PymwbAglwS00tQqrKiG1ex29V_Uplje7dbqV988MuyifJ1zBAesHGI0vger","coWde0lMz-Q:APA91bFZB9MRqO04ZOfk80VV8WAnmDng7_NPTPDGP2Bi0PbVhPPOT-
      Nr7vfmLiDDLA1N9Y-wAYv0pGDgKImKoN1uVgCQ_2uAfVexo0wM8UEs7tY8UNNXnZjSdzEK67XSlB8o6TIZQs0G"]
      }
  • Reference youtube url  Getting Started with Firebase Cloud Messaging on the Web - Firecasts

Friday, January 13, 2017

Create Ftp User

How to create a FTP user with specific /dir/ 

1. mkdir /var/www/mydomain.com
2. mkdir /var/www/mydomain.com/html
3. useradd <-username>
4. passwd <-username>
5. chown –R <-username> /var/www/mydomain.com



Set the home directory of the user with the following command

usermod -d /var/www/html/ ftpuser

Add Remote Origin to local Git Repository


Steps to add local files to  new git repository


Step 1: Switch to your repository's directory

cd /path/to/your/repo

Step 2: Connect your existing repository to github

git init
git remote add origin https://kotturs@github.org/tech/tech.git
git pull origin master
git add
git commit -m "message"
git push origin master

Friday, December 23, 2016

Enable the MUC (Multi User Chat) in Prosody

Enabling Components in prosody server



In the XMPP world, many services are provided in components, which allows for greater ease of customization within a basic framework. A common example of this is the MUC or multi-user chat functionality. To enable MUC services in Prosody you need to add a line like the following to your
/etc/prosody/prosody.cfg.lua file.

/etc/prosody/prosody.cfg.lua

Component "conference.example.com" "muc"

In this example, conference.example.com is the domain where the MUC rooms are located, and will require an “DNS A record,” that points to the IP Address where the Prosody instance is running. MUCs will be identified as JIDs (Jabber IDs) at this hostname, so for instance the “rabbits” MUC hosted by this server would be located at rabbits@conference.example.com.

MUC, in contrast to many other common components in the XMPP world, is provided internally by Prosody. Other components, like transports to other services, run on an external interface. Each external component has its own host name, and provides a secret key which allows the central server to authenticate to it. See the following “aim.example.com” component as an example.

/etc/prosody/prosody.cfg.lua

Component "aim.example.com"
component_secret = "mysecretcomponentpassword"
Note that external components will need to be installed and configured independently of Prosody.

Typically, Prosody listens for connections from components on the localhost interface (i.e. on the 127.0.0.1 interface;). If you’re connected to external resources that are running on an alternate interface, specify the following variables as appropriate in the global section of the configuration file before the first VirtualHost declaration.

/etc/prosody/prosody.cfg.lua

component_interface = "192.168.0.10"
component_ports = { 8888, 8887 }

Using prosodyctl


The XMPP protocol supports “in-band” registration, where users can register for accounts with your server via the XMPP interface. However, this is often an undesirable function as it doesn’t permit the server administrator the ability to moderate the creation of new accounts and can lead to spam-related problems. As a result, Prosody has this functionality disabled by default. While you can enable in-band registration, we recommend using the prosodyctl interface at the terminal prompt.

If you’re familiar with the ejabberdctl interface from ejabberd, prosodyctl mimics its counterpart as much as possible.

To use prosodyctl to register a user, in this case username@example.com, issue the following command:


prosodyctl adduser username@example.com
To set the password for this account, issue the following command and enter the password as requested:


prosodyctl passwd username@example.com
To remove this user, issue the following command:

prosodyctl deluser username@example.com
Additionally, prosodyctl can provide a report on the status of the server in response to the following command:


prosodyctl status
Note that all of the prosodyctl commands require root privileges, unless you’ve logged in as the same user that Prosody runs under (not recommended).