Wednesday, 31 August 2016

Angular JS hide default and click show div in controller

Angular JS hide default and click show div in controller:
=========================================

<!DOCTYPE html>
<html ng-app="showhide" >
<head>
<meta name="description" content="Simplest Controllers sharing Service" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
  <meta charset="utf-8">
  <title></title>
  <script>
  var app = angular.module('showhide',[]);
  function MyCtrl($scope) {    
    $scope.myvalue = false;    
    $scope.showAlert = function(){
      $scope.myvalue = true;  
       }; 
       }   
  </script>
  
  <body>
  <div>
    <div ng-controller="MyCtrl">
        <div><button id="mybutton" ng-click="showAlert()">Click me to show</button></div>
        <div>Value: {{myvalue}}</div>
        <div><div ng-show="myvalue" >Here I am</div></div>
    </div>
</div>  
</body>
</html>
  
  

Sublime text 2/3 package control install - for HTML Beatify and other pacakge

Sublime text 2/3 package control install - for HTML Beatify and other pacakge :
--------------------------------------------------------------------------------
Download Sublime text 2 or 3 after that Ctrl+shift+p -> Package Control : if not appear follow the procedure for HTMLbeatifier

According to its webpage:

A full-featured package manager that helps discovering, installing, updating and removing packages for Sublime Text 2. It features an automatic upgrader and supports GitHub, BitBucket and a full channel/repository system.
What's it mean? It's a Sublime Text package that makes it super-easy & convenient to install & manage all your other Sublime Text packages. Because of the ease of use it offers, Package Control really should be the first Sublime Text package you install.

Install the Package Control package
Follow these steps:
FOR windows:
============
Go to http://wbond.net/sublime_packages/package_control/installation & copy the long command there.

Open the Sublime Text 2 console by pressing Ctrl+`.
Paste the command you copied into the Sublime Text console.
import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
sublime text2 :
==============

import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; 
print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

Press Enter.
After Package Control installs, restart Sublime Text.

If you have licence kindly add the valid one.


sublime text3:
==============

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Press Enter.
After Package Control installs, restart Sublime Text.


NOW:
==== Package control -> type HTMLBeatify enter - > SHORTCUT -> WINODWS7 -> CRTL+ALt+shit+F for html



MMMMAAAACCC users
-----------------


Usage
Follow these steps:

Press Command-Shift-P (Mac OS X) or Ctrl-Shift-P (Windows) to open the Command Palette.
Start typing Package Control until you see the appropriate commands.
Some of the possible commands are:

Disable Package
Temporarily turn off a package (if you think it's causing problems, for instance)
Discover Packages
List all available packages in your web browser
Enable Package
If you disabled a package & now want to re-enable it
Install Package
List all available packages, allowing you to narrow down results by typing; clicking on the package will install it
List Packages
Show all installed packages, even those manually installed
Remove Package
Upgrade Package
Upgrade a specific package
Upgrade/Overwrite All Packages
Run this periodically to upgrade all your installed packages
Package Control Settings – Default
Package Control Settings – User
On other pages, I'll talk about some of the other packages you should install.

Ref:https://www.granneman.com/webdev/editors/sublime-text/packages/how-to-install-and-use-package-control/

AngularJS- How can I pass variables between controllers

AngularJS- How can I pass variables between controllers


<!DOCTYPE html>
<html ng-app="toDo" >
<head>
<meta name="description" content="Simplest Controllers sharing Service" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <script>
  angular.module('toDo',[])

.service('dataService', function() {
  // private variable
  var _dataObj = {};
 
  this.dataObj = _dataObj;
})

.controller('One', function($scope, dataService) {
  dataService.dataObj.end = "Yahoo";
  dataService.dataObj.begin = "customer";
  $scope.data = dataService.dataObj;
})

.controller('Two', function($scope, dataService) {
  $scope.data = dataService.dataObj;
})

;
  </script>
</head>
<body>
  REF: http://jsbin.com/tigebaguto/edit?html,js,output
  <div ng-controller="One">
    <div>Type and see your text in the other box:</div>
    <input ng-model="data.string">
     <input ng-model="data.string2">{{data.end}}
  </div>
 
  <hr>
 
  <div ng-controller="Two">
    <div>And now type here: </div>
    <input ng-model="data.string">
     <input ng-model="data.string2">{{data.end}}
  </div>
 
</body>
</html>

output:
---------

Monday, 29 August 2016

Angular Bootstrap dropdown list item selection from Controller

Angular Bootstrap dropdown list item selection from Controller
==============================================================

MyApp.controller('SubjectDropDownController', function ($scope) {

    $scope.subjects = ['Math', 'Physics', 'Chemistry', 'Hindi', 'English'];
});



We can bind the subjects array to create a dropdown as shown in the listing below:

<div ng-controller="SubjectDropDownController">
    <div class="dropdown">
        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
            Subject
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
            <li ng-repeat="a in subjects"><a href="#">{{a}}</a></li>
        </ul>
    </div>

----------***********----------

REf: http://www.infragistics.com/community/blogs/dhananjay_kumar/archive/2015/06/29/how-to-work-with-the-bootstrap-dropdown-in-angularjs.aspx

Default Checkbox checked and Component Visible ased on selection:

Default Checkbox checked and Component Visible ased on selection:
------------------------------------------------------------------

<!DOCTYPE html>
<html ng-app="plunker">

  <head>
    <meta charset="utf-8" />
    <title>AngularJS Plunker</title>
    <script>document.write('<base href="' + document.location + '" />');</script>
    <link rel="stylesheet" href="style.css" />
    <script data-require="angular.js@1.3.x" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.7/angular.js" data-semver="1.3.7"></script>
    <script src="app.js"></script>
  </head>

  <body ng-controller="MainCtrl">
    <p>Hello {{name}}!</p>
    
    <input type="checkbox" ng-model="checkBoxValue"   ng-init="checkBoxValue=true" id="myonoffswitch7"/>
                
     
         <div ng-show="checkBoxValue">
         <span class="teamsize">
         <label>Team Size</label><input type="text" />
         </span>  
         </div>
         
    
  </body>

</html>

Morris.js - chart Angular js Morris.js chart - donut option select level

Morris.js - chart Angular js Morris.js chart - donut option select level

include js:
----------

<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-morris-chart/1.2.0/angular-morris-chart.min.js"></script>

<div ng-controller="donutchart">
<div id="health" donut-chart donut-data='health'  ng-click="healthepopup()"></div>
</div>


Inject dependency
------------------

Make sure you injected angular.morris into your angular project

angular.module('my.app', [
    'angular.morris'
]).controller(controller="donutchart")({

// data from controle

$scope.health = [
           {label: "total", value: 40},
          {label: "Impacted",value: 38}
        ];



// or Option first option (25 :75) is selected by default

var health= Morris.Donut({
  element: 'health',
  data: [
    {label: "Impacted", value: 25},
    {label: "Remaining", value: 75}
  ],
  colors: ["#FF5252","#64B5F6","#455A64"],
  select :0  
});
health.select(0);

});

Friday, 5 August 2016

HTML, XHTML, DHTML, HTML5 ?

What is the difference between HTML, XHTML, DHTML, HTML5?

HTML:a. HTML is a markup language that is used to build static (non interactive and nonanimated) webpages.

b. HTML is Case-Insensitive. So, we can write in both uppercase and lowercase or combination of cases, this is allowed in HTML

c. No need of close tags for every opened tags in HTML

XHTML:

a. XHTML is a stricter and cleaner version of HTML.

b. HTML is Case-sensitive.

c. Each and every opened tags must be closed in XHTML

Example #1: XHTML Elements Must Be Properly Nested

In HTML, some elements can be improperly nested within each other, like this:
This text is bold and italic
In XHTML, all elements must be properly nested within each other, like this:
This text is bold and italic

Example #2: Empty Elements Must Also Be Closed
Empty elements must also be closed.
This is wrong:
A break: < br >
A horizontal rule:< hr >
An image: < img src="happy.gif" alt="Happy face" >
This is correct:
A break: < br />
A horizontal rule: < hr />
An image: < img src="happy.gif" alt="Happy face" / >

More XHTML Syntax Rules

  • Attribute names must be in lower case
  • Attribute values must be quoted
  • Attribute minimization is forbidden
  • The XHTML DTD defines mandatory elements

DHTML:

a. DHTML is NOT a language. DHTML is a term describing the art of making dynamic and interactive web pages. DHTML combines HTML, JavaScript, the HTML DOM, and CSS.

b. DHTML is Case-Insensitive like HTML. So, we can write in both uppercase and lowercase or combination of cases, this is allowed in DHTML

c. No need of close tags for every opened tags in DHTML

HTML 5:

  • New Elements
  • New Attributes
  • Full CSS3 Support
  • Video and Audio
  • 2D/3D Graphics
  • Local Storage
  • Local SQL Database
  • Web Applications

Wednesday, 3 August 2016

Boostrap - .col-xm, .col-sm, .col-md, .col-lg, .col-xl Property and screen resultion

.col-xs extreme small size - mobile size <=544px
.col-sm Small size - Smartphone sise >=768px
.col-md Medium size- Avg Desktop size >=992px
.col-lg Large size - Bigger Desktop screen resolution >=1200px
.col-xl Extra Large size - Largest (TV) Screen >=1280px

<class=".col-xm-12" > is usual screen width implementation. 


Extra small
<544px
Small
≥544px
Medium
≥768px
Large
≥992px
Extra large
≥1200px
Grid behaviorHorizontal at all timesCollapsed to start, horizontal above breakpoints
Container widthNone (auto)576px720px940px1140px
Class prefix.col-xs-.col-sm-.col-md-.col-lg-.col-xl-
# of columns12
Gutter width1.875rem / 30px (15px on each side of a column)
NestableYes
OffsetsYes
Column orderingYes

Monday, 4 July 2016

Getting start with Android Studio with Ubundu Linux -

   
Below are the steps to install Android Studio in Ubuntu system: 

---------------------------- Update on July-2016:-----------------------------
TASK1:
======

1. Install JDK 6 or later

First, install Oracle JDK 8 (although you could also choose OpenJDK but it has some UI/performance issues) using WebUpd8 PPA.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

To make sure, it’s installed successfully, open a terminal and type (you should get the version number of the jdk you’ve installed e.g javac 1.8.0_11)

javac -version
2. Download and install Android Studio

Download the Android Studio package for Linux and extract it somewhere (e.g home directory).

Link: ==> https://developer.android.com/studio/index.html

Then type :

cd android-studio/bin
./studio.sh
3. Install SDK Platforms (Selecting check box for the list of sdk manager running)

You need to install some SDK before you jump into building android apps. Click on Configure -> SDK Manager to open Android SDK Manager. Select the latest API (to test against target build, e.g API 19 (Android 4.4.2)) and some packages in Extras (Android Support Library and Android Support Repository). Then install the selected packages.


TASK2:
======

Error:Unable to run mksdcard SDK tool in ubuntu


This really needs to be added to the documentation, which is why I filed an issue about it a few months ago...

You need some 32-bit binaries, and you have a 64-bit OS version (apparently). Try:

Terminal CMD$> sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6


That worked for me on Ubuntu 14.10.

TASK3:
======

How to create AVD in linux Android studio

Android studio->tool->Android->AVD Manager -> create the device config and download the API's to run.

TAKS4:
======

USB debugging - Mostly Automatic confif, if device alread y in developer mode option enabled.ble

Start with mobile ->mobile->settings->about phone->Build Number-> swipe the number 7-14 times. developer option will enable.

TASK5:
=====

Create Desktop short cut ICON for Android Studio.

The simple solution is:

Go to Android Studio=>Tools=>Create desktop Entry..

Monday, 27 June 2016

Google Analytics-8 E-commerce Tracking

Google Analytics-8 E-commerce Tracking:
==========================


Enable Ecommerce in your reports:
-----------------------------------


You need to enable Ecommerce reporting in the view in which you want to see the data.

    Sign in to your Analytics account.
    Navigate to the desired account, property and view.
    In the VIEW column, select Ecommerce Settings.
    Click the Enable Ecommerce toggle ON.
    Optional: Click the Enable Related Products toggle ON.
    Click Next step.
    Click Submit.


Tracking setup with Google Tag Manager:
---------------------------------------
--

Ecommerce Tracking

There are two main types of of ecommerce implementation methods:

Standard ecommerce reports in Google Analytics allow you to analyze purchase activity on your site or app. You can see product and transaction information, average order value, ecommerce conversion rate, time to purchase, and other data.



<script>
window.dataLayer = window.dataLayer || []
dataLayer.push({
   'transactionId': '1234',
   'transactionAffiliation': 'Acme Clothing',
   'transactionTotal': 38.26,
   'transactionTax': 1.29,
   'transactionShipping': 5,
   'transactionProducts': [{
       'sku': 'DD44',
       'name': 'T-Shirt',
       'category': 'Apparel',
       'price': 11.99,
       'quantity': 1
   },{
       'sku': 'AA1243544',
       'name': 'Socks',
       'category': 'Apparel',
       'price': 9.99,
       'quantity': 2
   }]
});
</script>
   

Enhanced ecommerce adds functionality by allowing you to see when customers have added items to their shopping carts, when they have started the checkout process, and when they have completed a purchase. You can also use Enhanced Ecommerce to identify segments of customers who are falling out of the shopping funnel.

function() {
 var ecommerceData = {
   'ecommerce' : {
     currencyCode : 'EUR',
     // add additional parameters as needed...
   }
 };
 return ecommerceData;
}

Both methods of ecommerce tracking can be implemented with Google Tag Manager:
Google Analytics-9 User ID setup:
======================


Find the User ID setup flow in your account:
---------------------------------------------


The User ID is set at the property level. To find a property, click Admin, then select an account and a property. From the Property column, click Tracking Info then User ID.

Follow the step-by-step flow. Click the blue buttons to complete an action and move on to the Next step. After you complete a step, you can click edit at any time to revise your selections.


Analytics-> audience -> user Explorer -> List of client ID.......

user Demoghic- > browser details, time, timezone, country , state, city, browser details., etc.....


Set up the User ID in your tracking code
--------------------------------------------


After you enable the User ID by agreeing to the policy, you must implement the User ID in your tracking code. To use the User ID, you must be able to generate your own unique IDs, assign IDs to new users and consistently reassign IDs to returning users, and include these IDs in the data you send to Analytics. This step should be completed by a developer, see the Related resources section below for more information.

You can use the User ID for both websites and mobile apps. Both types of Google Analytics views (app and web) will accept both web and app hits and report them together. When using User ID, we recommend that you maintain a consolidated view that includes all types of hits, and that you configure filtered views to isolate web and app hits as necessary.

You can also click the toggle to turn session unification OFF at this step. Learn more about session unification.

Redux vs Redux Toolkit vs React Context

  These are often confused. Feature Redux Redux Toolkit Context API Purpose State management Simplifies Redux Shares values in Rea...