Monday, 26 September 2016

009 Weekend Tour Bakkali

Bakkali is famous weekend destination among Bengali. It comes under Namkhana-Kakdip sub division of 24 pgs(s) ,West Bengal , India . Bakkali is ideal for them who wants to spend some time in river side , calm atmosphere with pure and fresh water . Bakkali beach is around 8 km long ,it is wide from Bakkali to Frasergung .You can walk through the beach , with rolling waves of sea touching your feet. 





How to Reach : By train , take Sealdha to Namkhana local , it will take around 2.30 hour , from there , take a van , go to ferry ghat of Hatania-Doania river , crossing river , you will get local bus/private car for Bakkahli .It will take around 45 minutes.

By car , you can also come here , Diamond Harbour-Namkhana-Kakdip .You have to take ferry to cross your vehicle Hatania-Doania river.This special Ferry are available always.






Where to stay: There are a plenty of hotels in Bakkhali , you can stay Bakkahli  or Frasergung , it is you own choice. There are accommodation of West Bengal Tourism , I recommended to stay there . Other hotels are  Hotels Dolphin , Hotel Amrabati, , Balaka Lodge.

What to see : Bakkali beach is the main attraction of Bakkahli , other are Frasergung , Watch tower , Jambu Dwip , Henry’s island .




                         Bakkali beach is wide beach , you can spent a lot of time of your tour in this beach .You can take a long walk here. Sunset and sun shine is a huge attraction for the tourist.There is a temple called Bishlashimi at the end of beach , you can worship here .Here you will find plenty of red crab along the beach .The sea wave are gentle and smooth , some visitor and local people take bath in the sea also .During the low tide , some goes among the sea , as the sea are not so deep.


                    Next you can go Frasergung .There ,you will see wind mill , just beside the sea beach . From there you can go to Frasergung harbor. Here you will see a lot of fisher man , all are busy with there own work, some are repairing fishing net, some are cooking. A lot of fishing trawler are there , some are preparing to set their journey to the sea ,some have just come .You will see people are carrying fish from trawler .
 

      From this Harbour , you can hire a "bhut-bhuti" and set you journey to Jambu dwip. The is not quite smooth , only lion hearted fellow are advise to take the ride. A small island with dense forest is the attraction of the island.


         Henry’s island is the next attraction of Bakkali .You have to hire  a car/ van to go there .While going there , you will watch Mangrove forest around you , tree of sundari , goran, hetal all arounf you , in between there are several pond , this are cultivation of porn locally know “Bagda Chinri” .There is watch tower , you can go to the top and take a view of the total island.

Download / Upload large files in C# Asp.Net

 
Download / Upload large files in C# Asp.Net
                               In web application download and upload are very common . Earlier the file was small .500 kb text file , 500 kb image file ot doc file of maximum 1 mb . Now with enhancement of technology , normal images getting high definition images , normal video files to high definition videos , the size of this files are long . I can remember in 1997 , we use floppy disk to store information , which maximum capacity was 1.44 Mb.Now days , a still photo comes with more than 1 Mb . However , as developer we have to handle the situation with demand . Now I am showing , how we will upload & down load Large files

Upload large file
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DownloadFile.aspx.cs" Inherits="DownloadFile" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <INPUT type=file id=File1 name=File1 runat="server" >
    <asp:Button ID="btnUploadFile" runat="server" onclick="btnUploadFile_Click"
        Text="Upload File" />
    </form>
</body>
</html>
protected void btnUploadFile_Click(object sender, EventArgs e)
    {
        string FileName = "AAOHN Headquarters - August 10th Webinar Video.wmv";
        string PathName = @"C:\\Users\\abanerjee\\Desktop\\download_large_files\\LargeFile\\" + FileName;
     
        string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);
        string SaveLocation = Server.MapPath("DownLoad") + "\\" + fn;
        try
        {
            File1.PostedFile.SaveAs(SaveLocation);
            Response.Write("The file has been uploaded.");
        }
        catch (Exception ex)
        {
            Response.Write("Error: " + ex.Message);
             
        }
    }
----------------------web.config-----------------------------------------------

xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime
executionTimeout="90"
maxRequestLength="524288000"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
enableVersionHeader="true"
/>
  </system.web>
</configuration>

Upload larger file is similar to upload file , one change is there , you have to just change 
maxRequestLength value as per requirement , to handle  500 Mb files we have changes it to
524288000 .No other changes are required .




Download a larger file 500Mb/1GB/2GB
-------------------------------------

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DownloadFile.aspx.cs" Inherits="DownloadFile" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:Button ID="btnDownLoad" runat="server" onclick="btnDownLoad_Click"
            Text="Down Load" />
   
    </div>
   
    </form>
</body>
</html>

protected void btnDownLoad_Click(object sender, EventArgs e)
    {
       
        //here we have taken a sample file name and path
        string FileName = "myfilename.wmv";
        string PathName =  "c://MyFiles/"+FileName;
        
        //we are checking file exists or not 
        if (System.IO.File.Exists(PathName) == false)
        {
            return;
        }
        else
        {
            System.IO.Stream myStream = null;

            try
            {
                myStream =
                    new System.IO.FileStream
                        (path: PathName,
                        mode: System.IO.FileMode.Open,
                        share: System.IO.FileShare.Read,
                        access: System.IO.FileAccess.Read);
                //
                long lngFile = myStream.Length;
                long lngData = lngFile;
                Response.Buffer = false;
                Response.ContentType = "application/octet-stream";
                Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName);               
                Response.AddHeader("Content-Length", lngFile.ToString());
                // **************************************************
                //looping through the streaming length
                while (lngData > 0)
                {
                    if (Response.IsClientConnected)
                    {
                        // 8KB
                        int intBufferSize = 8 * 1024;

                        byte[] bytBuffers =
                            new System.Byte[intBufferSize];

                        int intTheBytesThatReallyHasBeenReadFromTheStream =
                            myStream.Read(buffer: bytBuffers, offset: 0, count: intBufferSize);

                        Response.OutputStream.Write
                            (buffer: bytBuffers, offset: 0,
                            count: intTheBytesThatReallyHasBeenReadFromTheStream);

                        Response.Flush();

                        lngData =
                            lngData - intTheBytesThatReallyHasBeenReadFromTheStream;
                    }
                    else
                    {
                        lngData = -1;
                    }
                }
            }
            catch { }
            finally
            {
                if (myStream != null)
                {
                    //Close the file.
                    myStream.Close();
                    myStream.Dispose();
                    myStream = null;
                }
                Response.Close();
            }
        }
    }





Friday, 23 September 2016

Bulk copy in Sql server & C#


Bulk copy in Sql server & C#
                  Bulycopy is an utility to copy data from source from destination for larger data . It can be text to Microsoft Sql server or Sql server to text file or text file to text file or sql server to sql server . This is and utility present in both Sql server and C#/Vb.net . Developer decides which way , he should use . Both bulk copy operation comes under transaction management . Bulk copy can be Single operation or Multiple operation .The simplest approach to performing a SQL Server bulk copy operation is to perform a single operation against a database , that is called Single operation , You can perform multiple bulk copy operations using a single instance of a SqlBulkCopy class , that is called Multiple operation . In this article we will see some simple example of bulkcopy . First we will see how to do with sql server.

Sql Server to text file :
--1. we are createing a table first
CREATE table tbl_bulkcopy
(
id    INT identity,
name  VARCHAR(50),
roll  INT
)
--insert data to the table
INSERT INTO tbl_bulkcopy(name,roll) VALUES('Ayan',20)
INSERT INTO tbl_bulkcopy(name,roll) VALUES('John',21)

--declare some use ful variable
DECLARE @fp             NVARCHAR(200)
DECLARE @fn             NVARCHAR(200)
DECLARE @sql            NVARCHAR(200)
DECLARE @opqry            NVARCHAR(200)

--set values of the variable
SELECT @fp ='C\copypath\'
SELECT @fn ='bulkcopy.txt'
SELECT @opqry='type '+@fp+@fn
---
---write the select query
SELECT @sql='SELECT name ,roll FROM tbl_bulkcopy'
---create the bulk copy script
SET @sql =  'bcp ' + '"' +  @sql + '"' +  '  queryout "' + @fp + @fn +'"   -c -q -C1252 -T '
--run the script in command shell
EXECUTE master..xp_cmdshell @sql
--
--to see the output of the file , please write the code
--or you can open the file directly
EXECUTE master..xp_cmdshell @opqry


Text file (.txt, csv) to Sql Server
--1. we are createing a table first
CREATE table tbl_bulkcopy
(
 id    INT identity,
[field1] VARCHAR(500),
[field2] VARCHAR(500),
[field3] VARCHAR(500),
)
--place the correct path of your file     
--you can specify field deliminator , row deliminator
--you can spcify error file also
BULK INSERT tbl_bulkcopy
FROM 'C:\dataloading\ex311316\outgoing\10_Group_Sub_Group.txt'
WITH
(
    FIRSTROW = 2,
    FIELDTERMINATOR = ',',  --CSV field delimiter
    ROWTERMINATOR = '\n',   --Use to shift the control to next row
    ERRORFILE = 'C:\dataloading\ex311316\outgoing\bulkcopy2p.txt',
    TABLOCK
)
EXECUTE master..xp_cmdshell @opqry
--
--
SELECT field1,field2,field3 FROM tbl_bulkcop

012 Weekend Tour Ambika Kalna

  Ambika Kalna  

                      Ambika Kalna is a small town in the district of West Bengal india .The town is located at the bank of Bhagirathi River and have a good history. Amika Kanlna is well know for 108 Shiva temple and Ambika kali temple , beside this you will see Rash Mach, Pratapeshaer temple , Lalji temple  ect.The town is named after the Goddess Kali , Ma Ambika.








108 Shiva Mandir : Here you will get 108 Shiva Temple in circular way . There are two circle , the outer circle contain 75 Shiva temple and the inner circle contain 35 Shiva temple . Each temple contain a idol of lord Shiva (Shiva Linga) , some of the are white and some are black .The place is under Archaeological survey of India .Well maintained and well decorate garden with green grass and flower tree .If you like to worship , you will get Bhamhin just siting by the side of the gate and ask him to assist you to worship . The temple are build on a platform , you have to climb 3 to 4 stairs to get on the platform.It is just 4Km away from Kalna station.You will get Risksaw /Auto to reach there .We hire a Ricksah , the cost was 20/-. This temple Known as Nava Kailash.The temple build by Bardhaman Maharaj Tej Chandra in year of 1809 .







                         One the other side of the rad of Nava Kailash , you will see a walled area , getting there you will get the most beautiful temple architecture of Bengal , Pratapeshaer temple,decorated with terracotta .This place also comes under Archaeological survey of India  and well decorated green garden , you can spend some time here ,. The temple was build on 1849 in Deul style.

                         By walking some step , you will get Rash Manch , a Bengali cultural,traditional festival dedicated on lord krisna.Other than this you will get Lalaji Temple and Krisnachandra Temple , Both have a good history.







How to Go : There are plenty of train from Howrah and Sealdah
                     Howrah –Katwa local :5.38AM,7.53AM,10.00AM
                     Sealdah –Katwah local:8.04AM,11:50AM

You should reach Ambika Kalna almost after 2 hrs by train.
You hire a Rckshaw or Auto and Getting around the town. We did the same , the Cost was 100/-.You can rive your won car also, the distance between Kolkata and Kalna around 90km.

Where to Stay :I did not find and good quality hotels to stay , however you can eat at Priyadarshini hotels .The hotel is just beside the main road ans driver to go there.


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

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