31 Oct 2015

How to Make Hard Choices ? [TED Video]


Each moment we are making choices for every single task we do, but there comes a time when we struggle a lot to make some hard choices which are going to shape our future and we becomes so confused to choose from available options that maximum time we lends up with a wrong choice.

Remember that
"You are free to choose but not free from the consequences"
So whatever choice we choose today that is going to define us tomorrow.

Standard practice of making a choice from available options is to write down the cons and pros of each available option and going with an option having higher pros seems right, but this procedure does not results in favorable outcome every time.

Below is a TED video that will change the way we make some of future shaping choices,
Please go through full video.


27 Sept 2015

Developing Notifications In android

Notification in android  is a special type of message which is used to show useful information when your app's UI is not visible to user.
Creating Notification is very simple, even you can create Notification by simply reading android Developer Guide.
Today I am will provide a ready to use code for creating notification for your app, Just copy this code and paste in your app code.
notification
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
 public void createNotification(){

     NotificationCompat.Builder builder = new NotificationCompat.Builder(this);

// Following Three notification contents are *required 
     builder.setSmallIcon(R.drawable.notification_icon);
     builder.setContentTitle("Notification Title");
     builder.setContentText("Notification Details");

 // intent to start activity, provide Activity name where you want user to
  //to land when he/she clicks on notification, like: MainActivity

     Intent resultIntent = new Intent(this,MainActivity.class);

// Task builder to implement normal navigation 
     TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
     stackBuilder.addParentStack(MainActivity.class);

     stackBuilder.addNextIntent(resultIntent);

     PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);
     builder.setContentIntent(resultPendingIntent);

     NotificationManager mNotifym = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// specify notification id,as first argument, i.e. I have used id=10
     mNotifym.notify(10, builder.build());


 }

 For Removing Notification use following code.
NotificationManager mNotifym = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        mNotifym.cancelAll();

This is a basic version of notification, you can add more feature by going through documentation. 

15 Aug 2015

how to Learn Android App Development ?

For Learning Android Development, there are thousands of tutorial available online, But choosing one which explains concepts in a easy way is very difficult.

Today I am going to list out some of best online resources to learn Android Development,most of these Tutorial are available free of cost. And if you are new to android Development, then before going to any other Tutorial, I would suggest you to go through following Tutorials which very useful and conceptual tutorials.

  1. Android Development for Beginners - Udacity : Video Tutorial for Complete beginners.
  2. Training for Android developers - Web based Text Tutorial Covering Basic Concepts By Google.
If during going through above Tutorial you find some topics difficult to understand then Google for that particular topic.
After going through above Tutorials you can go for any other tutorial, like Android Essential Training from Lynda.com.
Best Way to learn is to Develop small Apps,which cover basic android concepts, while learning Android Development.

So in the upcoming posts in this series of Android Development i will be posting Ideas and Concepts for Developing simple android Apps. 

11 Jul 2014

How to enable offline mode in Google chrome

If you want to browse web pages while offline in Google chrome then better learn following tip.
This method works in PC , Mac and android devices.
To enable offline mode type following in the address bar of Google chrome and click on enable option in follow up screen.

chrome://flags/#enable-offline-mode

Now browse web page saved in browser while you are offline (like. While traveling in a plane).


2 May 2014

CurioWhite - Free and Clean Blogger template

Curiowhite is a free and clean template for blogger with many built in features like, related posts widget, Prettyprint, YouTube video embedder, auto content selector etc.
This theme is best for those bloggers who are looking for a simple and clean theme for their blog.

How to use Curiowhite blogger template ?

1. Download the template or just copy the code.
2. Go to your blogger dashboard and choose 'Template' option and then click on 'Edit HTML' tab

3. Back up your current theme
4. Now remove your older template code and paste CurioWhite template code.
5. Click on 'Save Template'.

Customizing Curiowhite blogger template configuration

1. Primary Menu


    For adding custom primary menu in header section of blog, Search for "primary menu" in the above theme code and change menu as according to your need,

2. Pretty print for posting code inside blog post
    If you want to put some code inside blog post then put your parsed code inside <pre></pre> and theme will automatically assign prettyprint class to it.For printing line number add class="linenums" to <pre> element.
Example,

       i. Without line number ,
           <pre>
                &lt;div&gt;  This is a html Div  &lt;/div&gt;
           </pre>
          final look,
    <div>This is a html Div </div>
      ii.  With line number ,
         <pre class="linenums">
              &lt;div&gt; html Div1  &lt;/div&gt;
              &lt;div&gt; html Div2 &lt;/div&gt;
         </pre>
<div>html Div1 </div>
<div>html Div2 </div>

3. Element content selector

    This theme automatically adds a function to select inner contents of <pre></pre> elements, to apply to other elements just add a onclick function 'selectElementContents(this)'.
<div ondblclick="selectElementContents(this)" > double click to select content of this div </div>

4. Related Posts widget

    This widget display posts with similar label.For more details visit this link.It takes first image of your post as a thumbnail image for display in related post. To remove it, search for 'Related posts'  and delete JavaScript and css.

5. YouTube video embedder

    This widget embeds YouTube video with the facility to load asynchronously.for details visit this link

29 Apr 2014

how to install windows 8 operating system on any usb device?

Now you can have Windows 8(.1) operating system installed on a flash drive and use it as a portable system, using it's new feature 'Windows To Go'.
But you can install it only on a bootable certified USB drive.

What if you do not have a bootable certified USB drive ?
Don't worry, recently I came to know about a software WinToUSB ,using which anyone can install windows 8 operating system on any external hard drive or even on a flash drive.

Once installed on your flash drive you can run this operating system on any computer system.Just plug-in your flash drive and select flash drive from booting option during start-up of windows.

How to install Windows OS on external hard drive or a pen drive ?

  1. Get a .ISO file of windows 8(.1) operating system
  2. Download and install WinToUSB
  3. Run WinToUSB and follow steps as directed, 
for example I am installing windows 8 on my flash drive (USB 2.0), So process snapshots are given below.

1. Browse For your windows .iso file location


2. Select Destination disk and system partition


3. Click Next and wait till installation is completed.


Restart your pc and press F9 key [it depends on system, may be different for your system] to open advance boot option and select boot from you pen drive/flash drive.
Usually it takes long time for installing on flash drives, so  it is highly recommended to use a USB hard disk.


27 Apr 2014

How to Automatically Select Content of a HTML element for copy to clipboard

Sometimes you want to let your users to select certain portion of your web content for copying to clipboard, And for this user has to select content manually.
But using below mentioned script anyone can select entire content of a HTML element just by single/double click.

Steps for implementation.
First assign a 'onclick' or 'ondblclick' function with function call (as shown below)to your HTML element.For example,
      <!-- Calling select funtion on double click -->
    <div ondblclick="selectElementContents(this)"> Double click to Select content of this div !! </div>
Now define a JavaScript function named as 'selectElementContents()',
     function selectElementContents(el) {
                    if (window.getSelection && document.createRange) {
                       // IE 9 and non-IE
                       var range = document.createRange();
                       range.selectNodeContents(el);
                       var sel = window.getSelection();
                       sel.removeAllRanges();
                       sel.addRange(range);
                    } else if (document.body.createTextRange) {
                       // IE < 9
                       var textRange = document.body.createTextRange();
                       textRange.moveToElementText(el);
                       textRange.select();
                    }
            }

That's it, Now your user can select entire content just by double clicking inside the element.
Test this code by double clicking above code area.

18 Apr 2014

Simple Jquery Masonry like script to arrange elements in vertical space

This is a Jquery script which places elements in optimal position based on available vertical and horizontal space.It arranges items in vertical column and width of vertical column is taken as width of first 'item' element.

If you have elements with 'float:left' property and if they are of different heights then arrangement looks like as following image.
But if you use this script then result looks like as follows. [ Elements are arranged in optimal position in vertical space.]

How to arrange elements in vertical space?

First create an parent element and assign a class="container" and assign class="item" to the child elements which will be arranged in vertical space.
<!-- HTML -->
<div class="container">
    <div class="item">1.</div>
    <div class="item wv">2.</div>
    <div class="item w">3.</div>
    <div class="item wv">4.</div>
    <div class="item wv">5.</div>
    <div class="item">6.</div>
    <div class="item w">7.</div>
</div>
Now provide some CSS for above elements.
/* --- CSS --- */
.item {
    display:block;
    width:80px; 
    margin:5px;
    background:grey;
    min-height:30px;
    float:left;
    position:relative;
    border:1px solid green;
}
/* classes for variation in height*/
.w {
    min-height:40px; 
}
.wv {
    min-height:50px;
}
And here comes over final Jquery Script.Note: this script arranges items in vertical column and width of vertical column is taken as width of first 'item' element, change accordingly if you want.
<!-- JavaScript -->
$(function () {


    $('.item').css('position', 'absolute');
    rearrange();
    $(window).resize(function () {
        rearrange();
    });



    function rearrange() {


        var ti = $('.item').length; //total number of items
        var cw = $('.item').first().outerWidth(true); //column width
        var mr = parseInt($('.item').first().css("marginLeft"), 10); //margin left
        var mt = parseInt($('.item').first().css("marginTop"), 10); //margin top
        var contw = $('.container').width(); //container width

        if (contw < cw) {
            return; // if column width is greater then available space.
        }

        var pl = Math.floor(contw / cw); // no. of items per line

        for (i = 1; i <= ti; i++) {
            var upElement = (i - pl);
            var left = (i % pl);
            var leftv = 0;
            if (left == 0) {
                leftv = ((pl - 1) * cw) + mr;
            } else {
                leftv = ((left - 1) * cw) + mr;
            }

            if (upElement > 0) {
                var upELem = $('.item:nth-child(' + upElement + ')');
                var upTop = upELem.position().top;
                var upH = upELem.outerHeight(true);

                $('.item:nth-child(' + i + ')').css({
                    top: (upTop + upH),
                    left: leftv
                });

            } else {
                $('.item:nth-child(' + i + ')').css({
                    top: mt,
                    left: leftv
                });
            }
        }

    }
})();

To view live demo, click here. (Change window size to view horizontal arrangement.)
This script is inspired by already available jquery plugin, Jquery Masonry.