Thursday, 24 May 2018

005 KnockoutJS template binding

Template binding  is a sophisticated way to bind a template with associated DOM  result of rendering a template. Template binding smart  to build a sophisticated  interface structure  may be repeated and nested as per the function of view model data.

There are two type of template binding


Native
templating : Native templating generally used for printing for each , if , with control flow  bindings. This type of bonding capture the HTML markup  element and use as a template rendering against data item.

String based templating : String based computing is a way to connect  to third party template. By passing model  value to the external template , inject  the templates string  to the HTML document.



Parameters

To make a template the following properties can be sent as parameter-value to template.

  • name − The ID of an element that contains the template you wish to render .
  • nodes − This represents an array of DOM nodes to be used as the template.This     is optioanl if you have also passed a nonempty value for name. 
  • data − object data will be render  via the template.
  • if − The Template will only be rendered only if this parameter expression evaluates to true.
  • foreach − To loop template in foreach format.
  • as − This is to make an alias in foreach element.
  • afterAdd, afterRender, beforeRemove − Callable functions to be executed depending on rendered DOM elements.

A Simple named template

In this example, we have used person template and the template is wrapped with script tag. To prevent the template as JavaScript execution it typed dummy is  added  in the scripted.


 
Example



<!DOCTYPE html>
<body>
           <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"
type="text/javascript"></script>

            <div data-bind="template: { name: 'person-template', data: myName }"> </div>

<script type="text/html" id="person-template">
 
        
                 
 
</script>
<script type="text/javascript">

var myViewModel = function ()
{
        this.myName = { FirstName: 'John', LastName: 'Rich' };
};

ko.applyBindings(new myViewModel());

</script>
</body>

Output :

John Rich



A Simple named template with foreach

The following is a example of foreach parameter along with template name.

Example

<!DOCTYPE html>
<body>

            <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"
type="text/javascript"></script>

<div data-bind="template: { name: 'person-template', foreach: myName }"> </div>

<script type="text/html" id="person-template">
         
         
</script>

<script type="text/javascript">

var myViewModel = function ()
{
          this.myName = [{ FirstName: 'John 1', LastName: 'Rich 1' },
                                    { FirstName: 'John 2', LastName: 'Rich 2' },
                                    { FirstName: 'John 3', LastName: 'Rich 3'}]
};
 
ko.applyBindings(new myViewModel());

</script>
</body>

Output :

John 1 Rich 1
John 2 Rich 2
John 3 Rich 3


Creating alias Using as Keyword for foreach Items

The examples for how and alias can be created with foreach.

Example



<!DOCTYPE html>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"
type="text/javascript"></script>


<ul data-bind="template: { name: 'seasonTemplate', foreach: myData, as: 'season' }"></ul>
<script type="text/html" id="seasonTemplate">



  • </script>
    <script type="text/html" id="monthTemplate">
    |
    </script>
    <script>
    var viewModel = {
    myData: ko.observableArray([
    { FistName: 'John 1', LastName: 'Rich 1', Marks: [90, 100, 95] },
    { FistName: 'John 2', LastName: 'Rich 2', Marks: [89, 99, 96] },
    { FistName: 'John 3', LastName: 'Rich 3', Marks: [88, 98, 97] },
    { FistName: 'John 4', LastName: 'Rich 4', Marks: [87, 97, 98] }
    ])
    };
    ko.applyBindings(viewModel);
    </script>
    </body>

    Output :














    Using afterAdd, beforeRemove, and afterRender

    In some situation, you need some extra code  to be puted  after some event. After ad function  is invoke  when a new item is added in array

    Example

    <!DOCTYPE html>
    <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"
    type="text/javascript"></script>
    <script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
    </head>
    <body>
    <div data-bind="template: {
    name: 'person-template',
    foreach: myPerson ,
    afterRender: RenderMe
    }">
    </div>
    <script type="text/html" id="person-template">
    </script>
    <script type="text/javascript">
    function viewModel() {
    this;
    this.myPerson = ko.observableArray([
    { fisrtName: 'Jonh 1', lastName: 'Rich 1' },
    { fisrtName: 'Jonh 1', lastName: 'Rich 2'},
    ])

    this.RenderMe = function (elements, data) {
    $(elements).css({ color: 'Green' });
    }
    }
    ko.applyBindings(viewModel);
    </script>
    </body>
    </html>

    Output
    Jonh 1 Rich 1
    Jonh 1 Rich 2


    Wednesday, 23 May 2018

    018 Weekend Tour Netarhat

    Netarhat is a small town under the district of Latehar (early known as Palamou) in the state of Jharkhand ,India. Netarhat is very popular tourist spot full of scenic beauty. Netarhat is a hill station covered with thick forests. It is situated on top Chota Nagpur Plateau. Netarhat is around 150 km journey from Ranchi. Netarhat do not have any Railway station nearby,  you have to reach  Netarhat via road only.Netarhat is called  "queen of Chota Nagpur".

    Mongolian Point : Mongolian point is around 10 km from Netarhat. It is famous for viewing sunset. The sun  goes down slowly among the series of hills ,birds return their home , created a magical environment. 








    Upper Ghaghri Falls : It is small waterfall , falling  water towards the ground,  this place is a famous picnic spot. It is 4 kilometre from  Netarhat.

    Lower ghaghri Falls : Lower Ghaghri falls is about 10 km  from Netarhat. Dense forest, and a small waterfall of around 30 to 32 meter  creating a small river like  water flow , in between the jungle.

    Koel View Point : Koel View Point is 3 km from Netarhat. The place is about natural scenic beauty. One side there is a large pine forest, view at that point is very fantastic, you can take a long breath of fresh air with pleasure of eyes towards a greenie surrounding.

    Lodh Falls : Lodh falls is 60 km from Netarhat. It is the highest waterfall in Jharkhand. You will be able to hear the sound of the waterfall from several kilometre away. The falls  consists of multiple distinct drops, that create a thundering sound and beautiful picture itself.








    Pine Forest : By the road , you will notice pine forest and pine in the ground. Netarhat have a plenty of pine  tree all around it.


    Nashpati Garden : You will see Nashpati tree and Nashpati Garden around the Netarhat.











    Betla National Park : Betla National Park is 38 km from Netarhat  in hilly terrain of Palamu District of West Ranchi. Betla National Park is  a national park . Safari is available for tourist. You can do Safari by elephant or by car. You should keep in mind that elephant safari is only in the morning and afternoon. Animals like nilgai, sambhar deer, Mouse deer, Panther, wolf, jackal  are found here.

    Netarhat is around 150  kilometre from Ranchi. You have to go by road, there are only few hotels to stay. Prabhat Vihar of Jharkhand tourism is  very popular among the tourist. You will be able to see sunrise in the morning from Prabhat Bihar  hotels rooftop.


    018 Weekend Tour Varanasi



    Varanasi is a holy city in the state of Uttar Pradesh , India. It is situated on the bank of river Ganges. Ganges river's sacred water, Kashi Vishwanath Temple , dashashwamedh Ghat  is very popular among Hindu. Varanasi is known as Banaras and  Kashi.

    Kashi Vishwanath Temple : Krishna temple is very popular among Hindus. It is a temple of Lord Kashi Vishwanath. It is known at Golden Temple.








    Dasaswamedh Ghat : Dashashwamedh Ghat is one of the religious sites  for Hindus. It is believe that Lord Bramha  successfully perform the ritual of  Dasa Ashwamedha here.

    Asi Ghat : 
    Asi is the southernmost ghat of Kashi.

    Banaras Hindu University : Banaras Hindu University is located at Kasi , it is a Central University, spreaded over a large area. Engineering , journalism ,law , science , medical , management many more different kind course conducted here.Thousands of student stay here in the hostel. It is among the top most University in the India.













    Saranath : Saranath is around 13 km away from Varanasi. The Ashok lion pillar Akshara northeast the main attraction of the Sarnath. You can visit to Chinese temple adjacent to the Sarnath.

    Durga temple : Durga temple is situated on the bank of river Ganges at Durga Ghat. The temple is dedicated to the Devi Lord Durga.

    Ramnagar Fort : The fort was built by Maharaja Balwant Singh in 17 the  century at the bank of river Ganges. You can visit the fort , several articles of that royal family  Preserved here. You will see  artifacts,car ,arm,furniture, armour of that time.

    River Ganga :  River Ganga is the main  attraction of Varanasi. You will notice a number of small boat over the Ganga, people are  riding the boat. The boat will show you  the Ganga Ghat one by one
    Asi Ghat
    dashashwamedh Ghat
    Harishchandra Ghat
    Tulsi Ghat.

    ect.


    But most people gather to see Ganga Arti in the evening. Arati means Agni Pooja . Ganga aarti is a magnificent even during the evening in the Varanasi. Ganga Aarti start around 6.45 PM  and last around 45 minutes. You can go to the Ghat to see the Ganga Arati  or you can  hire boat to see the Ganga Aarti from Ganges.Thousand of pilgrims shout “Ganga Maiyya ki jai”.


    Harishchandra Ghat : Harishchandra   Ghat is  one of the cremation ground of Varanasi. This is named after the king Raja Harishchandra.





    There are a lot of hotel in Varanasi and its surrounding. It is suggested to stay near Temple. Varanasi can be visit throughout the year. Temperature of Varanasi is comfortable round the year.

    017 Weekend Tour Budge Budge

    Budge Budge is it small town under south 24 Pargana district of West Bengal , India. Budge Budge is situated at the eastern bank of Hooghly river . In 1897  Swami Vivekananda landed at Budge Budge frerry ghat  while returning from his Chicago visit. Budge Budge is well connected with Kolkata by train and Road. It is around 33 km  from Kolkata.

    Achipur : Achipur well known for Chinese temple. It is almost 9  kilometres from budge budge.The temple was built long ago during British region when the area was populated by Chinese people. Structure of the temple is typical Chinese Temple with wood carving.


    Achipur Ferry Ghat :  It is just beside the Chinese temple. You will see the ship crossing the Ganges and get the gentle breezy , take a fresh breath.

    Bawali : Bawali is very near to Budge Budge,it is around 9 km from Budge Budge .You can reach Bawali in two ways via Amtala or via Budge Budge. Bawali has a old glorious history .The most attractive places is Bawali Rajbari. It is around 300 years old with antique furniture. Recently the Rajbari has been  renovated and you can book room to stay here .


    Budge Budge Kali Mandir : Budge Budge Kali Mandir is situated just beside the Budge Budge ferry Ghat. The God  is Mata Kali.Each year Ras mela is happen here.


    Indira Ghat Park : Famous for picnic spot.In winter , lot of picnic pary comes hare.Great place for bring your children.
    Budge Budge is a one day trip , no need to stay there overnight, there are many small  road side hotels from where you can take your lunch.

    You can reach Budge Budge both train and bus. There are several train  for almost every half an hour from Sealdah. It take almost 1 hour from Sealdah to Budge Budge. Road is well connected with Budge Budge also, buses via Tara Tola and Amtala comes to  Budge Budge.

    Tuesday, 22 May 2018

    003 Weekend Tour Chakla Dham

    Chakla Dham is a pilgrimage place, situated near Barasat of North 24 Pargana of West Bengal. As per believe , this is the birthplace of the famous God  Baba Loknath . It is a holy and pilgrimage place, most visitor  come here to Worship  Baba Loknath. Religious people offer Pooja to Baba Loknath and take his blessings.

    The nearest railway station of Chakla Dham is Guma.Guma to Chakla is about 15 km journey. Local auto rickshaw and  motor van  are available  to reach Chakla.

    There are  number of small shops that are selling  flower,sweets to offer ,mala adjacent to the main temple.You can purchase from here and offer to the God. The temple systems are very organized. You can take bhog from Mandir. You have to purchase booking sleep of bhog from the booking counter .Bhog are offer in two rate , Rs.65/- and Rs.35/-. We purchased  Rs.65/-  sleep for bhog. This is called "Rajbhog", in Rajbhog they offered Fried Rice ,Khichuri,Soabin Curry ,Charney,Payas . Around 1.30 p.m bhog was served.

    Each day thousands of  devotee come here to offer Pooja to god Locknath.Several festival is celebrated in Chakla Dham.

    Janmotsav , 10th of August is  consider  birthdate of Lokenath Baba , the birthday  is celebrated with Pooja . Thousands of people come here from different part of the country. Other than this  Makar Sankranti ,Shivratri ,poila baisak also celebrated here.

    Chakla Dham is well connected with Kolkata by road and train. You can reach Chakla by 2 hours driving  or by Sealdah to Guma train.

    002 Weekend Tour Guptipara

    Guptipara is a semi town at the bank of Hooghly river, it is 80 km distance from Kolkata. Guptipara is good for 1 days Short trip from Kolkata and its adjacent.You can visit Guptipara all rounder year.
    Here are some attractive please to see at Guptipara.









    Vaishnava Temple :  It is the most attractive place of Guptipara. It is a example of Bengal temple architecture.Made of aachata  structure, Terracotta carving,hut  shape  temples. There are four  Chaitanya,Brindabanchandra, Ramchandra, Krishnachandra Temples.













    Desh Kali Mata Mandir : It is a temple of god Kali. It is very old temple, and original Temple has been removed with new structure. Thousands of devotee  comes here  each day to worship Lord Kali. During Kali Puja, Kali idol is made of mud, is wordshhiped overnight and send for immersion.










    Guptipara Sen Bari : Jamindar of Keerthi chandrasen of hatkhola para.

    From Kolkata, you have to reach Guptipara station by train. Plenty of auto and ToTo are available  to reach this places.They charge only 7/8 rupees  per person only.

    You can go to visit Bandel,
    Bandel is adjasent to Guptipara.

    As it is one day tour, no need to night stay.

    There are some small hotels you can take your food from there.

    Guptipara is very famous for sweets  and festivals."Gupo sandesh" and "Makhan Sandesh " is very popular among the Bengali. Guptipara celebrate Dol ,Ras,Rath Yatra  and other traditional Bengali cultural festivals.







    (We visited at a rainy day ,take lunch at a small hotel,this is the view from that hotel).

    To reach Guptipara  you have to take
    Howrah-katwa Local or Sealdah-katwa local .It will take around 1.45 hour ,to reach Guptipara.

    001 Weekend Tour Digha

    Digha is a coastal Resort town of purba Medinipur in the state of West Bengal , India. Digha have a wide ,long sea beach of Bay of Bengal. It is a famous tourist place near Kolkata and surrounding area peoples. Digha has of two parts , New Digha and Old Digha. The sea beach of Old Digha so long ,that it is connected to  New Digha. Almost all the year, thousands of tourist visit Digha each year.
    Weather is pleasant  here all  around the   year. Wave of sea , sand in sea beach, adjacent forest  attract tourist  to come here repeatedly.

    Digha is well connected  to Kolkata. It is nearly about 175 km journey from Kolkata. Both train and bus route are available to reach Digha. Here are the places you can visit at  Digha.








    Sea beach : Sea beach is the main attraction of Digha. High waves ,  wide beach, gentle  breeze  attract tourist very much. Tourist take bath in sea hours after hours. Walking Alone the beach is also  favorite for tourist. Currently horse riding , water scooter, boating  have started for tourist entertainment purpose.

    Udaipur Beach :  It is also a beach  of Bay of Bengal. Very near to the state Orissa. From new Digha, you can walk along the sea beach and reach to Udaipur. Or you can take a car,Rickshaw  to go to Udaipur. Udaipur beach also wide ,high waves , surrounding forest. Udaipur beach is quite lonely compared to the NewDigha and Old Digha. Those who are interested, some calm sea beach , and spend their time hours and hours here.

    Talsari Beach :
    Taalsari is one of the attraction of Digha. You can take a rickshaw, car to go to talsari.It is in the state of Orrisa and 8-10 km distance from New Digha.


    Amarabati Park:  Amarabati Park is situated near New Digha. It is a man made Park, decorated with several kind of trees  there are several kind of  entertainment for kids and  young. The main attraction of Amarabati Park is rope way.A small lake with boating facility , tourist can enjoy.

    Marine Aquarium : Marine aquarium is situated between New Digha and Old Digha. It is walking distance for New  Digha. In marine aquarium you can see ,sea species like fish, crab  of different color at different shapes. It is very much attractive for young learner  and kids.

    Kajal Dighi :  It is adjacent to New Digha. You can take a rickshaw or Toto  to reach there. You can  reach there by walk also. The main attraction of Kajal Dighi is troy train. Beside troy train , boating  and other entertainment for young and kids are available there.

    Chandaneswar Temple : It is also near to the new Digha and the state of Odisha. It is old Shiva Mandir .

    Shankarpur :
    Shankarpur is a fishing Harbour near Digha. It is a half an hour journey from Digha. Take a bus or hire a car to visit Sankarpur. You will see ,sea beach and hundred of fishing boat of different color at Shankarpur beach.

    Science Museum : It is also near to the New Digha, it is walking distance from New Digha. A number of amusement of science is there, you can play and enjoy the amusement.3D  show, magic show  are part of science museum.





    You can reach Digha  both bus and train. From Dharmatala and Howrah bus stand , there are buses almost every hour. Other than Dharmatala and Howrah, many private and government bus is available  from Baruipur, Budge Budge ,Sonarpur  also. Buses takes 4.5 to 5 hours  to reach Digha.

    Train route also well connected to Digha

    • 12857  Tamralipta Express
    • 12847  Duronto Express

    Digha have lots of Hotel. Lots and lots hotels ,guest house, holiday home etc.Most of the hotel restaurant with Bengali foods. You can enjoy  fried fish  sea beach in the evening.

    Adjusent to sea beach and surrounding area , Digha have  thousands of small shops . Handmade home decorating element made from sea shell , bamboo are sold here.

    বাঙালির বেড়ানো সেরা চারটি ঠিকানা

      বাঙালি মানে ঘোড়া পাগল | দু একদিন ছুটি পেলো মানে বাঙালি চলল ঘুরতে | সে সমুদ্রই হোক , পাহাড়ি হোক বা নদী হোক। বাঙালির ...