Monday, 19 September 2016

008 Weekend Tour Raichak


  Raichak

Raichak is a small town in Diamond Harbour in South 24 pargana of West Bengal in India. It is famous picnic spot near kolkata. It is located on the bank of the Hooghly river only Located only 50 kms away from Kolkata .Raichak is only two-hour drive away from Kolkata. A beautiful river bank ideal for picnic and weenend destination .Diamond Harbour is very close to Raichak this acts as a link between Haldia and Kolkata .One can visit Diamond Harbour from here or can go to Haldia by crossing river over launch.You can take of a breathe of fresh air.





Where to Stay : There are some hotels , one can book easily from kolkata or going there.You can book The Ffort Raichak,Raichak Guest House,Anaya Kutir ect.
When to Go : Best time will be winter .






 How to Go : From Kolkata , take Diamon Hourbour bound bus, ask to stop at Raichak more.

005 Weekend Tour Hanseswari Temple

Hanseswari Temple of West Bengal
This Sunday we visited Hanseswari Temple , Bansberia .The beautiful Mandir and adjacent temple is ideal for 1 day visit from kolkata , specially who like to wordship .There are two temple , Hanseswari and Vasudev Temple , which is  maintained by Archaeological Survey of India (ASI).There is a good history of this temple. Hanseswari is a hindu temple of lord Hanseswari.The temple build by Raja Nrisinhadeb Roy Mahasay in 1788.The shape of the tower of the temple look likes lotus flower.





How to go : Bansberia is a station between Tribeni and Bandel .One can avail direct katwa local to reach Bansberia or one can reach  Bandel , from Bandel  , train are available for Bansberia . Some can hire TOTO to reach the temple direct from Bandel also.





                 Bansberia surrounding is calm , those who are tired of crowded city kolkata , they will enjoy the calm ambience of this area. Roads are well build and most of the local convenience is TOTO , Auto .We hired a TOTO. The driver told us , Bansberia is famous for “Kartic Puja”. In kartic puja huge number of pandal , procession and thousand of gathering happen here.

                    You can read the history of Hanseswari Temple  by searching internet and several book are available in the market.

While returning , you can come through Bandel also. You can visit Bandel Chuch ,Imambara also.




Where to Eat : Near Bansberia there is no good restaurant .One can take “Bhog” of Mandir by paying 35/- , but you have to enlist your name before 10 AM . Second option is , there is a Dhaba between Bandel and Basberia , beside the high road .One can take food from there also.



Train:
Howrah-Katwa local –5:30 AM
Howrah-Katwa local –8:00 AM
Sealdah-Katwa local –11:50 AM
Howrah-Katwa local –15:25 PM

004 Weekend Tour Taki , Hasnabad

Taki , Hasnabad ,West Bengal

                     Taki is a small city situated at the bank of ichamati  . The city is very close to Bangladesh border . Location ,scenic beauty , beauty is marvelous .It is ideal place for all age oneday weekend tour .It is also famous picnic spot of west Bengal .One can reach there by 2 hours driving  from kolkata . Distance between kolkata and taki is 73 Km , though the main attraction of Taki is ichamati river , you can see Bangladeh from far also , but in Durgapuja  “Dasami” , both country local people  of Inda and Bangladesh celebrate “Bhasan” together.







Where to stay  : There are some Guest house near icamati river . Taki Torist Bunglow , Sunchine Guest house are among them . Booking from kolkata also possible .One can take meal to Taki tourish bunglow .Meal are testy as well as Good ambience.



Tourist spot : Ichamati river is the main attraction of Taki .During travel we hired a cycle van.There are road side by side of the river .You can enjoy the view of the river while travelling by van.Opposite side of the river , you will noticed Bangladesh .Machranga deep is the second attraction of Taki .You have to go there by Launch.





The next attraction is “Mini Sndarban” . You can also hire a cycle van to reach there . Artificial bridge , Sundari tree, Hetal tree is planted and look like a dense forest .You can visit the whole mini forest by walk .

Other place of attraction is Zamindar Bari , Zora Shib mandi r, Taki Govt High Shool and many more.





How to reach  :From Sealdah take Hasnabad local ,reach Taki in 2 Hours . After that hire a cycle Van to visit the city.

Sealdah-Hasnabad local :5:15AM
Sealdah-Hasnabad local : 6:12AM
Sealdah-Hasnabad local : 7:47AM
Sealdah-Hasnabad local : 8:20AM
Sealdah-Hasnabad local : 9:18AM


Friday, 16 September 2016

Scrolltop jquery


Scrolltop jquery
 
                     Technology are dynamic , it changes frequently . When we ate attached with web development , web development technology , style , look and feel also changes with time . Earlier we used to build a site with several html pages and put link to navigate among the pages .Now thins have changes . Most of the web pages are large , contain lot of information in a single page .This is due to , with the advancement of technology , internet speed have been very much high . It can pull a large page in a second .Thus most of the maker are trying to build a single page website , contain lots of data. Loading speed does not matter. Some write tutorial , which have a good length.

                       User goes from one portion to another portion of a site , generally they goes from the top to bottom .It is tedious to scroll mouse each time to go top of the site . Jqery scrollTop is a option which drive user to  the top of the serene
 
Here is the full code of a html page
 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<style>
.mycss{
       width:100px;
       height:130px;
       padding:10px;
       text-align:center;
       font-weight: bold;
       color: #444;
       text-decoration: none;
       position:fixed;
       top:75px;
       right:40px;
       display:none;
}
.mycss:hover{
       text-decoration:none;
}
</style>
<body>
<a href="#" class="mycss">Scroll Up ↑</a>
</body>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
 </html>
<script type="text/javascript">
    $(document).ready(function () {

        //Check to see if the window is top if not then display button
        $(window).scroll(function () {
            if ($(this).scrollTop() > 100) {
                $('.mycss').fadeIn();
            } else {
                $('.mycss').fadeOut();
            }
        });
               
        $('.mycss').click(function () {
            $('html, body').animate({ scrollTop: 10 }, 1000);
            return false;
        });

    });
</script>


 Explantion : https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
This is the link of jqery , we can download also.

mycss : This is the class desined for the button

script : This is the heart of this functionality , $(window).scroll , fires when we scroll widows, here  if  scroll value is more than 100 ,the button will visible.
The second part is $('html, body').animate({ scrollTop: 10 }, 1000);
This tells that html bogy will scrollup to top 10 points at the animation speed of 1000

Output : 

 Step 1

  
Step 2

Step 3




 Step 4

















 


Concatenating Row Values in Transact-SQL, How to Convert ?

Concatenating Row Values in Transact-SQL,  How to Convert ?

                               Microsoft SQL Server is a relational database management system . The main purpose of this software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network , and also works for mobile application.
            
                                    While retrieving data , the Microsoft Sql Server retrieve data base on column name . For example if we write that “Select Surname from tbl_family”. It will retrieve all Surname from family table . It will be row wise , for example Surname1 will come first row , Surname2 will comes in the second rows.

Example :
           Select Surname from tbl_family

Output:
Surname
Surname 1
Surname 2
Surname 3
Surname 4


                  That is Good  . But I can across a form where it was asked , “ Please put , the surname of the family member :“ .I need to give all the surname of the family member in a single row , but Select query was returning in row , that is each Surname in different row . Then what is the solution of this problem ?

                 Suppose , I am designing a report where the same written  “ Please put , the surname of the family member :“ , now I need to put all surname in comma separated line .How to solve the problem ? The are two ways .



THE FIRST WAY:
 I am creating a table

CREATE TABLE tbl_family
(
id            INT IDENTITY,
Surname VARCHAR(500)
)


Now we are inserting values into this table

INSERT INTO tbl_family(Surname)
SELECT 'Surname 1'
UNION
SELECT 'Surname 2'
UNION
SELECT 'Surname 3'
UNION
SELECT 'Surname 4'
UNION
SELECT 'Surname 5'
UNION
SELECT 'Surname 6'
UNION
SELECT 'Surname 7'
UNION
SELECT 'Surname 8'
UNION
SELECT 'Surname 9'
 
No I am declaring a variable


declare @sql VARCHAR(MAX)
SELECT  @sql=''

Now I am building query
SELECT  @sql=@sql+CASE WHEN @sql<>'' THEN ',' ELSE '' END +Surname FROM tbl_family
SELECT @sql

Now the output
Surname 1,Surname 2,Surname 3,Surname 4,Surname 5,Surname 6,Surname 7,Surname 8,Surname 9

You will noticed that separator con be any character or string as you wish .This is a fast way to build string from row data.

THE SECOND WAY:
 This is the smartest method , which I preferred . In this method we need not any variable , we can build such string in query , just using xml and stuff.Let us see the example
 

SELECT STUFF((SELECT ',' + ISNULL(x.Surname,'')
          FROM  tbl_family  x
          FOR XML PATH ('')),1,1,'')

The output will be
Surname 1,Surname 2,Surname 3,Surname 4,Surname 5,Surname 6,Surname 7,Surname 8,Surname 9

Now , FOR XML PATH to the end of a query allows you to output the results of the query as XML elements.

Thursday, 22 October 2015

How to convert the whole string to capital letter in Javascript


How to convert the whole string to capital letter in Javascript ?
toUpperCase--is use for making a string to capital letter
var str="This is a technical blog"
str=str.toUpperCase()
alert(str)
will show "THIS IS A TECHNICAL BLOG"

How to detect OS by javascript ?


How to detect OS by javascript ?

var oprating_system ;
oprating_system=' ';

if (navigator.appVersion.indexOf("X11")!=-1) oprating_system="UNIX";
if (navigator.appVersion.indexOf("Win")!=-1) oprating_system="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) oprating_system="MacOS";
if (navigator.appVersion.indexOf("Linux")!=-1) oprating_system="Linux";

What is JSON.parse ?

What is JSON.parse ?

Returns the Object corresponding to the given JSON text. Takes a well-formed JSON string and returns the resulting JavaScript object.

Example 1
        var obj = jQuery.parseJSON( '{ "name": "John" }' );
        alert( obj.name === "John" );


Example 2
var jsonString = '[{"name":"Manchester GTUG","meetup":"First Monday of every month","tags":["gtug","google","manchester","madlab"]},{"name":"Manchester jQuery Group","meetup":"First Tuesday of every month","tags":["jquery","javascript","jresig","madlab"]},{"name":"Hybrid!","meetup":"First Monday of every month","tags":["jquery","javascript","jresig","madlab"]}]';

var myData = JSON.parse(jsonString);

$(document).ready(function() {
    var $grouplist = $('#groups');
    $.each(myData, function() {
        $('<li>' + this.name + '</li>').appendTo($grouplist);
    });
});

Result :
Manchester GTUG
Manchester jQuery Group
Hybrid!

What is json.stringify ?

What is json.stringify ?

If the stringify method sees an object that contains a toJSON method, it calls that method, and stringifies the value returned. This allows an object to determine its own JSON representation.

Example 1.
       JSON.stringify([1,2,3,4,"open","the","door"]);
Result : produces "[1,2,3,4,"open","the","door"]"

Example 2.

var mangtug = {
        name: "Manchester GTUG",
        meetup: "First Monday of every month",
        tags: ["gtug", "google", "manchester", "madlab"]
    },
    manjquery = {
        name: "Manchester jQuery Group",
        meetup: "First Tuesday of every month",
        tags: ["jquery", "javascript", "jresig", "madlab"]
    },
    hybrid = {
        name: "Hybrid!",
        meetup: mangtug.meetup,
        tags: manjquery.tags
    };

var madlabGroups = [mangtug, manjquery, hybrid];

Result :

[{"name":"Manchester GTUG","meetup":"First Monday of every month","tags":["gtug","google","manchester","madlab"]},{"name":"Manchester jQuery Group","meetup":"First Tuesday of every month","tags":["jquery","javascript","jresig","madlab"]},{"name":"Hybrid!","meetup":"First Monday of every month","tags":["jquery","javascript","jresig","madlab"]}]

Tuesday, 31 March 2015

Joy of Class

CLASS Point to remember
 
*Constructor can not be declare as static

*In a class specified , data or function desined private are accessible to member function 
of the class

*Private data member can be accessed both from the base class and from its derived class

*A nonmember function apart from friend can not access nonpublic member of a class

*Protected members cannot be inherited


*A static variable declared inside a function exits till the execution of that function only


*The members of a class by default are private


*Member function cannot be called from within a constructor


*In case of nested class , enclosing class can directly access the private data member of nested class


*To initialise an object of a class A ,which is a data member of a class B,the construct of A has to be invoked in the constructor of class B


*If a friend function declare inside a class it can access all data members of the class


*A friend function declared insede a class does not need scope resolution operator while defing it


*Member of a derived class can only be accessed by the object or pointer to the same class


*A derived class can access the private members of its public base class directly


*Friend function can be inherited


*A virtual function cannot be declared a friend in another class

 1)How can you prevent your class to be inherited further?
You can prevent a class from being inherited further by defining it with the sealed keyword.

2) Is it possible for a class to inherit the constructor of its base class?
No, a class cannot inherit the constructor of its base class.

3) Can you declare an overridden method to be static if the original method is not static?
No. Two virtual methods must have the same signature.

4) Why is the virtual keyword used in code?
The virtual keyword is used while defining a class to specify that the methods and the properties of that class can be overridden in derived classes.

5) Can you allow a class to be inherited, but prevent a method from being overridden in C#?
Yes. Just declare the class public and make the method sealed.

6) Does .NET support multiple inheritance?
.NET does not support multiple inheritance directly because in .NET, a class cannot inherit from more than one class. .NET supports multiple inheritance through interfaces.

7) Is it possible to execute two catch blocks?
You are allowed to include more than one catch block in your program; however, it is not possible to execute them in one go. Whenever, an exception occurs in your program, the correct catch block is executed and the control goes to the finally block.

8) A structure in C# can implement one or more interfaces. Is it true or false?
Yes, it is true. Like classes, in C#, structures can implement one or more interfaces.

9) What is a static constructor?
Static constructors are introduced with C# to initialize the static data of a class. CLR calls the static constructor before the first instance is created.

The static constructor has the following features:
  • No access specifier is required to define it.
  • You cannot pass parameters in static constructor.
  • A class can have only one static constructor.
  • It can access only static members of the class.
It is invoked only once, when the program execution begins. 


 10)What is Static Method?
It is possible to declare a method as Static provided that they don't attempt to access any instance data or other instance methods.

11)What is New modifiers?
The new modifiers hides a member of the base class. C# supports only hide by signature.

12)What is Sealed modifiers?
Sealed types cannot be inherited & are concrete.
Sealed modifiers can also be applied to instance methods, properties, events & indexes. It can't be applied to static members.

Sealed members are allowed in sealed and non-sealed classes.

13)What is Protected access modifier in C#?
The protected keyword is a member access modifier. It can only be used in a declaring a function or method not in the class ie. a class can't be declared as protected class.

A protected member is accessible from within the class in which it is declared, and from within any class derived from the class that declare this member. In other words access is limited to within the class definition and any class that inherits from the class

A protected member of a base class is accessible in a derived class only if the access takes place through the derived class type.


14)What is Internal access modifier in C#?
The internal keyword is an access modifier for types and type members ie. we can declare a class as internal or its member as internal. Internal members are accessible only within files in the same assembly (.dll). In other words, access is limited exclusively to classes defined within the current project assembly.


15)What is a private constructor? Where will you use it?
When you declare a Constructor with Private access modifier then it is called Private Constructor. We can use the private constructor in singleton pattern.If you declare a Constructor as private then it doesn’t allow to create object for its derived class, i.e you loose inherent facility for that class.
Class  A

{
// some code
          Private Void A()
          {

           //Private Constructor
           }

}
 
Class B:A
{
//code
}
B obj = new B();// will give Compilation Error


16)Can we declare private class in a Namespace?
No. If you try to create a private class in a Namespace, Compiler will throw a compile time error “Namespace elements cannot be explicitly declared as private, protected, or protected internal”.

17)What is Early binding and late binding?
Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

18)Difference between sealed and static classes
sealed classes:

1)we can create their instances, but cannot inherit them

ex:

sealed class demo
{

}

class abc:demo
{
--Wrong
}

2)They can contain static as well as nonstatic members.

static classes:

1)we can neither create their instances, nor inherit them

ex:
static class Program
{

}

2)They can have static members only.

19)Static methods can not use non static members. True or False.
True

20)Static datamembers should be initialized inside the constructor. True or False.
False. Static datamembers should not be initialised inside constructor.

21)Why can't you specify the accessibility modifier for methods inside the interface?
you are not allowed to specify any accessibility, it's public by default.

22)Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.


23)Can you prevent your class from being inherited and becoming a base class for some other classes?

Yes, that's what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It's the same concept as final class in Java.

24)Can you override private virtual methods?

No, you cannot access private methods in inherited classes.

25)Can you declare the override method static while the original method is non-static?
No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.

26)What does the keyword virtual mean in the method definition?
The method can be over-ridden.

27)Can we have Sealed Method in abstarct class ?
Looking at first site the The Keyword Sealed & Abstract are contradictory to each other..In simple terms we can Say Answer is NO.Look the code below

using System;

abstract class A
{
public abstract void Hello();
public sealed void Hi();
}

when we will complie the code.. we will get the Compile time Error as below

'A.Hi()' cannot be sealed because it is not an override..

But the Crux is We can have Sealed methods in abstract class when the abstract class is Dervided class .. for Eg.

using System;

class A
{
public virtual void Hello()
{
Console.WriteLine(" Say Hello");
}

}

abstract class B : A
{
         public sealed override void Hello()
        {
        Console.WriteLine(" Say Hi");
         }

}

class C : B
{

}

class Demo
{
          public static void Main()
         {
            C c1 = new C();
            c1.Hello();// Output is Say Hi
           }
}


28)Can we have an Abstract class without having any abstract method ?

Yes we can have Abstract class without having any abstract method ..

See the code below

using System;
abstract class A
    {
          public void Hello()
          {
            Console.WriteLine(" Say Hi");
           }
}

class B:A
{
}

class Demo
{
         public static void Main()
        {
            B b1 = new B();
           b1.Hello();
        }
}

// Output is Say HI



the class A is abstract class.. but it does not have any abstract methods..

29)Can we define Method Overloading in different classes?
No,we can not define Method Overloading in different classes.It must be on the same class.
As we know that Function Overloading is defined in the same class.
We can understand it by an example:-

Below function are an example of Overloaded Constructor,which are defined on the same class.

public class Person
{
           public Person()
          {
          }

          public Person(int person_id)
         {
         }
}


30)Can Function Overriding be defined in Same Class?
No,Function Overriding can only be defined in different class because it treated as Base and Derived or parent-child relationship.


We can understand it by an example:-
public class Base_Class
{

   public Base_Class()
    {        

    }
    public virtual void display()
    {

        Console.WriteLine("base class");
    }

}

public class Derive_Class:Base_Class
{    public Derive_Class()
    {     

    }

    public override void display()    
   {
        Console.WriteLine("derive class");
    }

}

31)What are the advantages of partial classes?
Following are the advantages of Partial classes:-
1). We can separate User Interface part code and business logic code so that it is easy to read and understand by anybody.
2). More than one developers can work at a time.
3). As Partial classes can be separated then it can again be reunited of compilation.

Wednesday, 5 November 2014

MVC Routing Concept

URL stand for Uniform Resource Locator
for example www.abc.com/directory/emplyee.htm

URI is an identifier for some resource, but a URL gives you specific information as to obtain that resource.URL doesn’t necessarily mean a physical location of a static file on a web server’s
hard drive somewhere ,it means some unique identifier.

Most of the cases Webserver  and then directory and sub directory and file name

But in MVC the method is different
  1. MVC matches controller action rather than file system
  2. MVC also matches outgoing request with  controller action rather than file system

Route definitions start with the URL pattern, which specifies the pattern that the route will match. Along with the route URL, routes can also specify default values and constraints for the various parts of the URL, providing tight control over how and when the route matches incoming request URLs


Application_Start()   method contains a call to a method named the
RegisterRoutes method


 public static void  RegisterRoutes (  RouteCollection routes  )
{
      routes.MapRoute( “example”, “{first}/{second}/{third}”);
}

Routing: /albums /display/123
Result: first = “albums” second = “display” third = “123”
routes.MapRoute(“simple”, “{first}/{second}/{third}”);

The {action} parameter value is used to indicate which method of the controller to call in order
to handle the current request. Note that this method invocation applies only to controller classes
that inherit from the System.Web.Mvc.Controller base class. Classes that directly implement
IController can implement their own conventions for handling mapping code to handle the
request.

Any route parameters other than {controller} and {action} can be passed as parameters to the
action method, if they exist. For example, assuming the following controller:

public class AlbumsController : Controller
{
            public ActionResult Display(int id)
           {
                return View();
            }
}

ROUTE URL PATTERN                           EXAMPLES OF URLS THAT MATCH
{controller}/{action}/{genre}                      /albums/list/rock
service/{action}-{format}                            /service/display-xml
{report}/{year}/{month}                              /{day} /sales/2008/1/23

routes.MapRoute(“simple”, “{controller}/{action}/{id}”,new {id = UrlParameter.Optional});


Multiple default values can be provided. The following snippet demonstrates providing a default
value for the {action} parameter as well:
routes.MapRoute(“simple”, “{controller}/{action}/{id}”, new {id = UrlParameter.Optional, action=”index”});

using System.Web.Routing;

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

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