Friday, 13 May 2016

Text overflow at right side .....


Text overflow at right side of page make ..... for continues....

CSS:
=======
.class-left{
    text-overflow: ellipsis;
}

html:=
=======

<div>
<div class="class-left">aaaaaaaaaaaaa></div><div class="right">LINK</div>

Sunday, 24 April 2016

Sending data to Google docs from your web page

google spread Sheets as DB: 
=======================
Google Sheets as a Database – INSERT with Apps Script using POST/GET methods (with ajax eg)
-----------------------------------------------------------------------------------------------------------------------

goto Google.drive.com

Click->New-> google sheets

==> open new untitled spreadsheet

Name on your own ( Presale Email Subscribers)

Enter fields you want to store from Form

==> eg .timestamp, name, Email, phone,etc....


In Menu(sheet) ->Tools->Script Editor click

It open new Gogole app script editor with code.gs fine name

Enter project name ( Form Script)

Mention Sheet name in this script is mandatory. Eg. Sheet1

Enter the below code

------------------------
//  1. Enter sheet name where data is to be written below
        var SHEET_NAME = "Sheet1";

//  2. Run > setup
//
//  3. Publish > Deploy as web app
//    - enter Project Version name and click 'Save New Version'
//    - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
//
//  4. Copy the 'Current web app URL' and post this in your form/script action
//
//  5. Insert column names on your destination sheet matching the parameter names of the data you are passing in (exactly matching case)

var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service

// If you don't want to expose either GET or POST methods you can comment out the appropriate function
//function doGet(e){
//  return handleResponse(e);
//}

function doPost(e){
  return handleResponse(e);
}

function handleResponse(e) {
  // shortly after my original solution Google announced the LockService[1]
  // this prevents concurrent access overwritting data
  // [1] http://googleappsdeveloper.blogspot.co.uk/2011/10/concurrency-and-google-apps-script.html
  // we want a public lock, one that locks for all invocations
  var lock = LockService.getPublicLock();
  lock.waitLock(30000);  // wait 30 seconds before conceding defeat.

  try {
    // next set where we write the data - you could write to multiple/alternate destinations
    var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty("key"));
    var sheet = doc.getSheetByName(SHEET_NAME);

    // we'll assume header is in row 1 but you can override with header_row in GET/POST data
    var headRow = e.parameter.header_row || 1;
    var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
    var nextRow = sheet.getLastRow()+1; // get next row
    var row = [];
    // loop through the header columns
    for (i in headers){
      if (headers[i] == "Timestamp"){ // special case if you include a 'Timestamp' column
        row.push(new Date());
      } else { // else use header name to get data
        row.push(e.parameter[headers[i]]);
      }
    }
    // more efficient to set values as [][] array than individually
    sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
    // return json success results
    return ContentService
          .createTextOutput(JSON.stringify({"result":"success", "row": nextRow}))
          .setMimeType(ContentService.MimeType.JSON);
  } catch(e){
    // if error return this
    return ContentService
          .createTextOutput(JSON.stringify({"result":"error", "error": e}))
          .setMimeType(ContentService.MimeType.JSON);
  } finally { //release lock
    lock.releaseLock();
  }
}

function setup() {
    var doc = SpreadsheetApp.getActiveSpreadsheet();
    SCRIPT_PROP.setProperty("key", doc.getId());
}

Make to doPost() or doGet()


Click on the Save icon. Set the dropdown in the nav bar to 'setup’ and click on the right-pointing triangle to its left to run this function. It should show 'Running function setup’ and then put up a dialog 'Authorization Required’. Click on Continue. In the next dialog 'Request for permission - Formscript would like to’ click on Accept.

In the menus click on File > Manage Versions… We must save a version of the script for it to be called. In the box labeled 'Describe what has changed’ type 'Initial version’ and click on 'Save New Version’, then on 'OK’.

Back to the menus: click on Resources > Current roject’s triggers. In this dialog click on 'No triggers set up. Click here to add one now’. In the dropdowns select 'doPost’, 'From spreadsheet’, and 'On form submit’, then click on 'Save’.

Back to the menus: click on Publish > Deploy as web app… For 'Who has access to the app:’ select 'Anyone, even anonymous’. Leave 'Execute the app as:’ set to 'Me’ and Project Version to '1’. Click the 'Deploy’ button.

A dialog should appear announcing 'This project is now deployed as a web app’. Copy the Current web app URL from the dialog; it should look something like:

https://script.google.com/macros/s/AKfycbw6RTOxn5OT_BIw9Nl_3KoFSXEQEbiKSZCLyombb1YqkGfRKUSz/exec
Click OK.

Now go back to google-sheet.js and replace 'SCRIPT URL GOES HERE’ with the URL copied from the dialog.

Display or refresh the index.html web page. Enter data into the four fields and click on the 'Send’ button. Within a few seconds that data should appear in your Google sheet. If your browser is Google Chrome, right-click in the web page and click on Inspect Element > Console. It should show:

Hooray, it worked!
- Object
success
- Object
Well done! You can now modify this form and drop it into any web page to collect–at no cost–responses from those who visit your page. With a little research and effort you may be able to get Google Apps to email every time someone submits your form.

I plan to use it to collect names and email addresses of those who visit an MVP page, where the “product” is just a description of the SaaS site I have in mind. I may also use it on a stand-alone blog where I do not want to let readers post comments, but I would rather they send them to me so I can screen, remove spam, edit, and comment on them before putting them up.



full code for index.html and sheet.js
---------------------------------------


<!DOCTYPE html>
<html lang='en'>
  <head>
    <meta charset='utf-8'>
    <meta content='IE=edge' http-equiv='X-UA-Compatible'>
    <meta content='width=device-width, initial-scale=1' name='viewport'>
  </head>
  <body>
    <!-- Contact Form - sent to a Google Sheet -->
    <form id='foo'>
      <p>
        <label>Name</label>
        <input id='name' name='name' type='text'>
      </p><p>
        <label>Email Address</label>
        <input id='email' name='email' type='email'>
      </p><p>
        <label>Phone Number</label>
        <input id='phone' name='phone' type='tel'>
      </p><p>
        <label>Message</label>
        <textarea id='message' name='message' rows='5'></textarea>
      </p>
        <div id='success'></div>
        <button type='submit'>Send</button>
    </form>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  <!-- Custom Theme JavaScript -->
  <script>

// Variable to hold request
var request;

// Bind to the submit event of our form
$("#foo").submit(function(event){

    // Abort any pending request
    if (request) {
        request.abort();
    }
    // setup some local variables
    var $form = $(this);

    // Let's select and cache all the fields
    var $inputs = $form.find("input, select, button, textarea");

    // Serialize the data in the form
    var serializedData = $form.serialize();

    // Let's disable the inputs for the duration of the Ajax request.
    // Note: we disable elements AFTER the form data has been serialized.
    // Disabled form elements will not be serialized.
    $inputs.prop("disabled", true);

    // Fire off the request to /form.php
    request = $.ajax({
        url: "https://script.google.com/macros/s/AKfycbxNDXmWaInWS-aHhBB8XgSbxjR-kk0UI0C05g3pUQ2G8KghHPU/exec",
        type: "post",
        data: serializedData
    });

    // Callback handler that will be called on success
    request.done(function (response, textStatus, jqXHR){
        // Log a message to the console
        console.log("Hooray, it worked!");
        console.log(response);
        console.log(textStatus);
        console.log(jqXHR);
alert("success");

location.reload();
    });

    // Callback handler that will be called on failure
    request.fail(function (jqXHR, textStatus, errorThrown){
        // Log the error to the console
        console.error(
            "The following error occurred: "+
            textStatus, errorThrown
        );
    });

    // Callback handler that will be called regardless
    // if the request failed or succeeded
    request.always(function () {
        // Reenable the inputs
        $inputs.prop("disabled", false);
    });

    // Prevent default posting of form
    event.preventDefault();
});

</script>
</html>

Tuesday, 12 April 2016

Ng-style-Inline-Background-image == Use ng-Directive

To set background image for div in INLINE:
===========================================

<div ng-style="{'background': 'url({{images.logo}})'}"> </div>

Error:1
=======

In Ng inline style not appear in IE browser. So use ng-style instead of style.

Error:2
=======
ng-style="{background: url({{images.logo}})}"  is ERROR

use ' (quote) to use css 'key':'value'.

 ng-style="{'background': 'url({{images.logo}})'}">



SOLN + Additional Value:
========================

Use ng-hreg instead of href while using dynamic value.

<a ng-href="{{URL.path}}">ANCHOR LINK </a>

To avoid cross browser and IE related error. Use ng-directives.

Saturday, 2 April 2016

Use Multiple Mail ID for Testing.

Register user favorites name with @yopmail.com

Eas to access inbox from yopmail.com portal without password.

@note: Insecure port. Inbox can accessable if know username@yopmail.com

yopmial @yahoo product

No condition checkup for creation.

NG-Form Validation in controlle and service call


html-view:
==========

<form name="formname" ng-sbumit="ctrl.ctrlmethod(ctrl.model[formmodel], formname)" novalidate>
<label>Name</label>
<input type="text" name="name" ng-model="ctrl.model[formmodel].name" ng-pattern="/^[a-z ,.'-]+$/i" required />
<span ng-show="ctrl.crtlflagForm && formname.name.$error.required" class="ngMessagesClass"> Field should not be empty </span>
<div ng-messages="formname.name.$error" class="ngMessagesClass">
<div ng-message="name"> Invalid name/email format </div>
</div>
</form>


**[formmodel]- here taking all form values
For characters only ===> ng-pattern="/^[a-z ,.'-]+$/i" 
For staring with 789+9digits number ng-pattern="/^[789]\d{9}$/"
For ng-minlength, ng-maxlength


form.controller.js:
===================

 self.ctrlmethod = function(formdata, requiredvalidateForm) {

      self.formdataDetails = formdata;
      console.log(self.formdataDetails);
      self.requiredvalidateForm = true;
      var datalength = _.keys(self.formdataDetails).length;

      if (datalength === 1) {

        formService.serviceCall(self.formdataDetails).then(function(response) {

          if (response.statusCode === 200) {
            ngDialog.open({
              scope: $scope,
              template: 'success-popup.html'
            });
          }
          self.model = {};
          self.requiredvalidateForm = false;
          console.log("inCtrl " + response);
        }, function() {
          console.log("Some error occurred. Please check again");
        });

      }
    }


form.service.js
================

 self.serviceCall = function(userFormDetails) {
        var requestData = userFormDetails;
        console.log(requestData);
        var deferred = $q.defer();
        $http.post(config.Url.API, requestData).then(function(response) {
          if (response) {
            deferred.resolve(response.data);
          }
        });
        return deferred.promise;
      };


index.html/footer.html:      IN one of HTML/view Add template code
======================

<script type="text/ng-template" id="success-popup.html">
    <div class="success-popup">Nice to discuss with you!</div>
</script>

Cross Browser css issue with Media query

Full code for mozilla, opera, safari and Chrome:   APPLY CSS
================================================

 @media screen and (max-width: 767px) {

    div.take-me-top p {
            font-size: 10px !important;
        }

    /* moz - Firefox */
        @-moz-document url-prefix() {
            /* firefox-only css goes here */
            div.take-me-top p {
            font-size: 10px !important;
            }
        }

        /* opera */
        x:-o-prefocus,
        div.take-me-top p {
            font-size: 10px !important;
        }

        /* safari */
        _::-webkit-:not(:root:root),
        div.take-me-top p {
            font-size: 10px !important;
        }

    /* IE */
    * div.take-me-top p {
            font-size: 10px !important;
        }
        (or)
    @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    /* IE10+ CSS styles go here */
    .div.take-me-top p{
        z-index:1 !important;
    }


  
 /* chrome browser only */
@media screen and (-webkit-min-device-pixel-ratio:0) {
     div.take-me-top p {
            font-size: 10px !important;
        }}



@note : div.take-me-top p  is class property name




-------------------------------------------------------------------------------------------
mozilla browser + media query css code:
=======================================

  @-moz-document url-prefix() {
        /* firefox-only css goes here */
        @media screen and (max-width: 767px) {
            div.take-me-top p {
                font-size: 10px !important;
            }
        }
    }

this will work on other browser and media query:

 @media screen and (max-width: 767px) {
    @-moz-document url-prefix() {
        /* firefox-only css goes here */
       
            div.take-me-top p {
                font-size: 10px !important;
            }
        }
    }


opera:
======
p {
    background: green;
    }

x:-o-prefocus, p {
    background: red;
    }

or

/*opera only hack*/
    @media not all and (-webkit-min-device-pixel-ratio:0) { 
        .styled-select select{ 
           width:100%;
    height:24px;
        } 
    } 


safari Only:
=============

_::-webkit-:not(:root:root),
        div.take-me-top p {
            font-size: 10px !important;
        }


IE all Version:
================
* div.take-me-top p {
   font-size: 10px !important;
   }

/* css for ie only */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { }
   

Sunday, 24 January 2016

Facebook - share Dialog - FB.Ui

Facebook Share Dialog: JavaScript and Angular JS
================================================

Register with Developer.facebook.com as developer in public profile (FB Id/user account Required)

Step:1
=======
list required are:

Domain Name, App Name(APPID), URL, OAuthRedirect Url, Review and status as public, Select platform as Website/Android/iOS...

Step:2
======
Include FB_SDK in index.html:

<script>
    (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s);
        js.id = id;
        js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.5&appId=654932564610265";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>

step:3
======
Add the facebook connect page - onclick open popup dialog - Required page and section

<li>
  <a target="_blank" ng-click="FBConnect()">
  <img class="fa fa-facebook" src="../../fb.png" /></a>
</li>


step:4
=======

Call or Define Controller method for FB- within controller

$scope.FBConnect = function() {

        FB.ui({
          method: 'share',
          href: 'http://trinet.bornbaby.com/',
          title: 'Bahubali',
          picture: 'http://trinet.bornbaby.com/blog/blog-ps-1.jpg/blog-ps-1.jpg',
          caption: 'Domain Internet',
          description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',

        }, function(response) {});

      }

Auto start XAMPP when linux OS start / login

XAMPP:
=====
Automatically start it on login.
step:1
Open terminal and run following command.
$sudo gedit /etc/init.d/lampp

step:2
paste following code in opened file
#!/bin/bash
/opt/lampp/lampp start
save & close

step:3
run following command to make this script executable
$sudo chmod +x /etc/init.d/lampp

step:4
run following command to install init scripts to all runlevel
$sudo update-rc.d lampp defaults

step:5
restart the system

&
xampp would be start automatically. You can check it by opening
http://localhost in browser




Run Php - xampp in linux

How to run xampp php code in ubuntu:
------------------------------------
In this case you need to be root to start/stop LAMPP and to execute PHP code in it.

step:1
To become root just open the terminal and type the following command
(To avoid conflict stop lampp using this cmd $ /opt/lampp/lampp stop)
$sudo -i (Ntow the system by default as root. In older version ask password)


step:2
$cd /

step:3
ls

step:4
start lampp
$ /opt/lampp/lampp start

step:5
Write code - Terminal cmd
$gedit /opt/lampp/htdocs/FileName.php

New php editor open- Do your code here save and close

step:6
go browser ype:
http://localhost/FileName.php

Step:7
Rewrite the file
open file in terminal using
$ gedit /opt/lamp/htdocs/FileName.php


Note: My php root - www folder is located at computer->opt->lampp->htdocs

Linux - XAMPP

To start xampp in linux ubuntu:
-------------------------------

sudo /opt/lampp/lampp start

sudo /opt/lampp/lampp stop

sudo /opt/lampp/lampp restart

step:1
======
Go on XAMPP site and download XAMPP. URL to download XAMPP is
http://www.apachefriends.org/en/xampp-linux.html

step:2
Let the download complete. Confirm download by opening download folder.

step:3
Open terminal and move to download location. Verify that downloaded Xampp installer file exist there. If you have moved Xampp file in other folder than move that folder which contain Xampp file.

TERMINAL:$cd /home/[Username]/Downloads
TERMINAL:$ls

step:4
Make installer file to executable. Run following command

TERMINAL:$chmod +x xampp-linux-1.8.2-0-installer.run

Installation requires root privilege. Switch to root user. You need to suppply super user password to become root user. Super user is the user account which is created during the installation.

step:5
TERMINAL:$sudo -s -H

step:6
Run installer file
TERMINAL:$./xampp-linux-1.8.2-0-installer.run

step:7
Keep default selected component and click on next
Next->next->next->

step:8
XAMPP is successfully installed. But mysql server would not start automatically. You would get following error while accessing phpmyadmin
TERMINAL:$sudo /opt/lampp/lampp restart

STEP:9
Now access again phpmyadmin
http://localhost/phpmyadmin/




AWS account creation - Sep2026

AWS conosle to build AWS skills- Account creation inclues Digilocker - Aadhar connectivity, UPI autopay, mobile, email verification process.