Thursday, December 31, 2015

Integrate your GIT repository with Visual Studio 2015

 

You can now easily use visual studio with your solution in GIT. You can Commi, pull, push ans run all source control commands with in your favourite IDE visual studio. You dont need to use any third party tools for that. Integration in so much easy just new steps.

1. Visual Studio-> Team-> Manage Connections

2. Then you can see team explorer

image

3. Under Local GIT repositories Click on clone

image

in there on first text box enter your GIT repository URL and the the second one add the local path and then click clone then It will promted to enter your credentails/

It will download the source code from GIT with source control binding. After that you can see all source control commands related GIT available in your visual studio.

I .Commit your changes locally

after you done with the changes when you right click on a file , project or solution you can find the Commit option as follows. This will commit your changes to local repository.

image

II .Sync your code with server code

Before pushing your code to online GIt repositor you need sync your local repository with server. For that you can use the option sync then pull.

image

III .push your changes to server

Then you can push your changes to server using push option

If you are someone familiar with TFS this is very smiliar to use.Even command names are bit different it does almst the same function

Get rid of usafe tag on angular url

 

Issue :

I recently wanted to use html sms tag in my mobile web site. In the site I have used angual binding to dynamically bind the sms url as follows

<a id="lnk_sms" href="{{sms_Link}}"  class="sms-button social-media-button" alt="SMS" style="display:none">SMS</a>
 
href value is something like :- 'sms:?body=bodyText’

when I run the application agular keep adding a unsafe prefix infront of the url and sms functionality wasn’t working.

<a id="lnk_sms" href="'unsafe:sms:?body=bodyText’"  class="sms-button social-media-button" alt="SMS" style="display:none">SMS</a>

After spending hours I was able to find the problem and soltion

Problem :

Only http, https, ftp and mailto are enabled by default. Angular will prefix a non-whitelisted URL with unsafe:

Solution :

You need to explicitly add URL protocols to Angular's whitelist using a regular expression. A good place to whitelist the sms: protocol would be in your module's config block:

var app = angular.module( 'myApp', [] )
.config( [
    '$compileProvider',
    function( $compileProvider )
    {   
        $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
        // Angular before v1.2 uses $compileProvider.urlSanitizationWhitelist(...)
    }
]);

The same procedure also applies when you need to use protocols such as file: and tel:.

Please see the AngularJS $compileProvider API documentation for more info.

Hope this Helps!!!

Monday, December 28, 2015

Share you link in Social Media

Technorati Tags: ,

If you want to a share a link in you web app there are plenty of options available.

Recently I got a requirement to share a link , which is browsed through mobile. We have provided the following options to the users.

1. SMS

2. Twitter

3. LinkedIn

4. FaceBook

5. Viber

Following points gives you how to add the functionality to your site easily.

 

1. SMS

For this you have to just put the following HTML tag in to you application which is accessed via mobile. This will open the sms app in user’s mobile pre populated with the content which you have stated.

<a href="sms:/* phone number here */?body=/* body text here */">Link</a>

If you want it to work on iOS, you need this:

<a href="sms:/* phone number here */;body=/* body text here */">Link</a>

Apparently iOS8 had to go and change things on us, so thanks to some of the other commenters/responders, there's a new style for iOS:

<a href="sms:/* phone number here */&body=/* body text here */">Link</a>

(phone number is optional)

You can see a live demo here http://bradorego.com/test/sms.html (note the "Phone and ?body" and "Phone and ;body" should autofill both the to: field and the body text. View the source for more info)

 

2. Twitter

Twitter is really easy. All what you have to do is go to following link and twitter will generate the code to be pasted in you app.

https://about.twitter.com/resources/buttons#tweet

image

You will get something like this finally. Here I am sharing the current page URL.

<a href="https://twitter.com/share" class="twitter-share-button"{count}>Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

Rather sharing a link this page gives you generating code for buttons for follow,hashtag and mention.

 

3. LinkedIn

LinkedIn also provides you a button generation in the following link.

https://developer.linkedin.com/plugins/share

image

Here URL is optional. If you keep it blank and generate the button it will be default to current page, In case if you want to share a different URL then you can set it in the URL text box and generate the button. They have different options of buttons with number of shares as well.

finally you will get a code as follows.

<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="right"></script>

 

4. FaceBook

Following link provided you step by step on how to add a share button for facebook

https://developers.facebook.com/docs/plugins/share-button#configurator

image

same as the above once this also have a button generator where you just have to copy and paste it.

5. Viber

Viber provided the following link for you to integrate your web app with there viber app.

https://www.viber.com/en/developers/share_on_viber

Just going through two simple steps you can add share via viber options in you web app.

As you can see adding these functionalities are really easy and takes less time. But these functionality will increase traffic in you web app.

Hope this is helpful