http://www.imomin.webs.com

Thank You for Visit Me

Md. Mominul Islam

view:  full / summary

Introduction to JSON

Posted by imomins on July 11, 2011 at 6:22 AM Comments comments (0)

Introduction

As we know Ajax is a web development technology that makes the server responses faster by enabling the client-side scripts to retrieve only the required data from the server without retrieving a complete web page on each request, which will minimize the data transferred from the server.

These requests usually retrieve xml formatted response, the xml responses are then parsed in the JavaScript code to render the results. Which complicate the JavaScript code

The idea of JSON (JavaScript Object Notation) is to make the response a specific data structure that can be easily parsed by the JavaScript code.

 

Advantages

1- lightweight data-interchange format

2- Easy for humans to read and write

3- Easy for machines to parse and generate

4- JSON can be parsed trivially using the eval() procedure in JavaScript

5- JSON Supports: ActionScript, C, C#, ColdFusion, E, Java, JavaScript, ML, Objective CAML, Perl, PHP, Python, Rebol, Ruby, and Lua.

.

Syntax

The JSON Syntax is the convention which you will use it to generate data, it’s near to the C family language, so it can be parsed easily in the C family languages.

For objects start the object with “{“ and end it with “}”

object

{}

{ members }

·         For members (properties), use pairs of string : value and separate them by commas

members

string : value

members , string : value

·         For arrays put the arrays between []

array

[]

[ elements ]

·         For elements put the values directly separated by commas

elements

value

elements , value

·         Values can be  string, number, object, array, true, false, null

EXAMPLESJSON 

{"menu": {  

  "id": "file",

  "value": "File:",  

  "popup": {  

    "menuitem": [ 

      {"value": "New", "onclick": "CreateNewDoc()"},

      {"value": "Open", "onclick": "OpenDoc()"},  

      {"value": "Close", "onclick": "CloseDoc()"}  ]

  }

}}

XML<menu id="file" value="File" >  <popup>     <menuitem value="New" onclick="CreateNewDoc()" />     <menuitem value="Open" onclick="OpenDoc()" />     <menuitem value="Close" onclick="CloseDoc()" />  </popup></menu>

 

 

 

 

 

Server side codeThe following code will be generated in the server side to retrieve the server time, and in one step in the client side it will be rendered to JavaScript

Java <%@ page language="java" import="java.util.*" %>

<%Date date = new Date(); %>alert("The server time is: <%Úte%>");

<SPAN style="mso-tab-count: 1">          ASP.NET<%@ page language="C#" %>   alert("The server time is: <%=System.Date.Now.ToString()%>"); 

PHPalert("The server time is: <?=time()?>"); 

Client Side JavaScript//XMLHttpRequest completion function

var myOnComplete = function(responseText, responseXML){eval(responseText);}

 

http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=11

Tutorial on NHibernate and FluentNhibernate

Posted by imomins on July 11, 2011 at 5:42 AM Comments comments (0)

This tutorial will be well-understood with a project , that can be downloaded  from  here

DownLoad FullCode.

Background :In the past we all have spent a considerable amount of time writing a data access layer for our application. The overall time spent developing data access code could easily be 30% of the overall time used to implement the solution. There is one problem with this fact. Data access code is nothing special, nothing that adds business value to your application. (Nearly) every business application needs some kind of data access. So why would we continue to spend such a huge amount of time writing boring data access code?

NHibernate can and will take away the burden of our shoulders. Never again you will have to write and maintain stored procedures. Never again you will deal with ADO.NET and the like. When using a modern ORM tool you can concentrate on the core elements of an application, the ones that provide real business value. You can concentrate on the model of the business domain and the business rules there in. But this is enough for now. Let’s start to introduce NHibernate and its sister Fluent NHibernate. To make this introduction a little bit more realistic let’s first find an interesting domain. The domain should be well known to most of you people. What else could be a better fit that an order entry system? At the same time – to not make things too complicated – I have to define a rather simplistic order entry system. So let’s start.

Object Model first approach :One important change to consider when you develop a so called green-field application (a new application) is that you normally start with the object model of the domain for which you want to develop the application. In the past most of the time the data model was developed first. So you started with the entity relationship diagram (ERD). On top of that the application was then built. But in this article we want to first concentrate on the object model and let the database schema be generated automatically by NHibernate based on the object model. Don’t misunderstand me; I am not saying that one cannot use NHibernate to develop applications the other way around. NHibernate is also able to deal with the situation where there already is an existing data model and one has to build an application on top of this.

Mapping the domain model :Once we have our domain model in place we want to be able to store the state (of this model) in some place. Very often this is done by using a relational database management system (RDBMS) like SQL Server, Oracle, IBM DB2 or MySql to name just a few. When you are using NHibernate it doesn’t really matter which database product you’re going to use since NHibernate supports most of the well known database products. Your application will not be tied to a specific database.

NHibernate in a Nutshell :

NHibernate is an Object-relational mapping (ORM) solution for the Microsoft .NET platform,it provides an easy way to use framework for mapping an object-oriented domain model to a traditional relational database. NHibernate is a .NET based object persistence library which helps to persist our .NET objects to and from an underlying relational database. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

“If we use an RDBMS to store our data (or state) then the data is stored in tables. Thus we have to map our object model to corresponding tables in the database. This mapping doesn’t necessarily have to be one to one (and most often it is not). That is we do not always have mapping where one object maps to one table. Very often the content of one table maps to different object.”

FluentNHibernate in a Nutshell :

To be formal – “Fluent NHibernate provides a way for you no longer need to write the standard NHibernate mapping file (. Hbm.xml), but you can use the C # mapping file to write. Doing so, facilitate the reconstruction of our code to provide the code readability, and streamlining the project code.”

The greatest advantage of FluentNHibernate is – the mapping is type-safe since it is not based on strings.

In the past the mapping between the object model and the underlying database has been mainly done by defining XML documents.

Fluent NHibernate canceled the xml file.

Why  needs to replace the XML file?

a. XML is not real-time compiled. When your XML configuration file has errors, you can see only in the run-time what went wrong.

b. XML is very cumbersome. Indeed, in the NHibernate configuration file, xml node is very simple, but still can not cover up the cumbersome nature of XML file itself.

c. Repeat mapping file attributes set. For example, in xml, we need to set for each string type fields are not allowed to be empty, the length is greater than 1000, int type had to have a default value is -1, the end of the xml configuration file so you will find a lot of repetition work.

one can define the mappings in C# which is a full blown programming language and not only a data description language as XML is. This fact opens the door for many – previously unthinkable – possibilities since the mapping can now contain logic.

Step By Step Approach:

Now we will build a very simple web application  which will store, update, read and delete Car data using NHibernate and FluentNhibernate.

Step 1:

From the VS editor we will create a new web application. We will add reference of NHibernate and FluentNhibernate from here……

Step 2:

We will create a new class file by giving a name “Tables.cs”. In this class file we will add all the classes that we planned to map to the Database. At first we will create a very simple class named “Car” with properties (all class should contain property)

public class Core

{

public virtual int Id { get; set; }

}

public class Car : Core

{

public virtual string Title { get; set; }

public virtual string Description { get; set; }

}

Step 3:

Ok, so now we have to tell NHibernate how to map our entities to the database. We’re going to use the FluentNHibernate interface to do this, so all configuration is in code. We will create another class such as CarMap that inherits ClassMap<Car>. This is what lets FluentNHibernate know to use these mappings with the Car class we’ve just defined. If we look at the configuration,  it’s saying what’s the Id field. Handily called Id in this example. NHibernate has the ability to generate auto Ids and there are many options which are beyond our scope here. Lets have look to the code below.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using FluentNHibernate.Mapping;

namespace NHibernateTutorial

{

public class CarMap : ClassMap<Car>

{

       public CarMap()

       {

           LazyLoad();

           Id(x => x.Id);

           Map(x => x.Title).Not.Nullable().Length(100);

           Map(x => x.Description);

           Table(“Car”);

       }

    }

}

With this statement we define the mapping of the property Title which is mandatory and thus cannot be null. We also tell the system that its maximal length is 100 characters. If we do not explicitly define the name of the column in the corresponding table on the database will be the same as the name of the mapped property. In our case this is Title. Of course this can be changed anytime by using the appropriate syntax.

You might wonder what the LazyLoad() means. A Lazy Load interrupts this loading process for the moment, leaving a marker in the object structure so that if the data is needed it can be loaded only when it is used. I recommend you to read this Article1 & Article2  to know more about lazy loading.

LazyLoad() is an optional field.

Step 4:

Now the challenge appears- we need to tell NHibernate how to connect to the database.

At First We have to choose the Database. Here I have used SQLEXPRESS 2008 which is provided with VS 2010. Here I have created a database named ”nhub”. We will access this database through Server Explorer of the VS Editor.

Here is the place where we will apply our business logic and reduce the number and necessity of writing cumbersome stored procedures.

When we impose CRUD on RDBMS through NHibernate, all the operations is held by the NHibernate Session (Nhibernate session is different from ASP.NET session and they are totally different).  It may be easier to think of a session as a cache or collection of loaded objects relating to a single unit of work. NHibernate can detect changes to the objects in this unit of work..To handle these sessions we will use some interfaces that comes form NHibernate.These interfaces are the main point of dependency of application business/control logic on NHibernate.

Five basic Interfaces used as shown in the figure below; where IQuery and ICriteria performs the same operation.

ISession interface

1.  The ISession interface is the primary interface used by NHibernate applications, it exposes NHibernates methods for finding, saving, updating and deleting objects.

2.  An instance of ISession is lightweight and is inexpensive to create and destroy. This is important because your application will need to create and destroy sessions all the time, perhaps on every ASP.NET page request. NHibernate sessions are not thread safe and should by design be used by only one thread at a time. The NHibernate notion of a session is something between connection and transaction.

3.  We sometimes call the ISession a persistence manager because it’s also the interface for persistence-related operations such as storing and retrieving objects. Note that a NHibernate session has nothing to do with an ASP.NET session.

ISessionFactory interface

1.  The application obtains ISession instances from an ISessionFactory. Compared to the  ISession interface, this object is much less exciting.

2.  The ISessionFactory is certainly not lightweight! It’s intended to be shared among many application threads. There is typically a single instance of ISessionFactory for the whole application-created during application initialization, for example. However, if your application accesses multiple databases using NHibernate, you’ll need a SessionFactory for each database.

3.  The SessionFactory caches generated SQL statements and other mapping metadata that NHibernate uses at runtime.

4.  It can also hold cached data that has been read in one unit of work, and which may be reused in a future unit of work or session. This is possible if you configure class and collection mappings to use the second-level cache.

ITranscation interface

1.  The ITransaction interface, next to the ISession interface. The ITransaction interface is an optional API. NHibernate applications may choose not to use this interface, instead managing transactions in their own infrastructure code.

2.  A NHibernate ITransaction abstracts application code from the underlying transaction implementation-which might be an ADO.NET transaction or any kind of manual transaction-allowing the application to control transaction boundaries via a consistent API. This helps to keep NHibernate applications portable between different kinds of execution environments and containers.

IQuery and ICriteria interfaces

1.  The IQuery interface gives you powerful ways of performing queries against the database, whilst also controlling how the query is executed.

2.  It is the basic interface used for fetching data using NHibernate. Queries are written in HQL or in the native SQL dialect of your database. An IQuery instance is lightweight and can’t be used outside the ISession that created it. It is used to bind query parameters, limit the number of results returned by the query, and finally to execute the query.

3.  The ICriteria interface is very similar; it allows you to create and execute object-oriented criteria queries.

Now, I will discuss some points from my written code for configuring the FluentNibernate . We have create a class called ModelClass:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using FluentNHibernate.Cfg;

using FluentNHibernate.Cfg.Db;

using NHibernate;

using NHibernate.Tool.hbm2ddl;

namespace ModelClass

{

public class NHibernateHelper

{

       private static ISessionFactory _sessionFactory;

       private static ISessionFactory SessionFactory

       {

           get

           {

               if (_sessionFactory == null)

                   InitializeSessionFactory();

               return _sessionFactory;

           }

       }

       private static void InitializeSessionFactory()

       {

           _sessionFactory = Fluently.Configure()

               .Database(MsSqlConfiguration.MsSql2008

                             .ConnectionString(

                                 @”Server=fire-3\sqlexpress;Database=nhub;Trusted_Connection=True;”)

               .Mappings(m =>

                         m.FluentMappings

                             .AddFromAssemblyOf<Car>())

               .ExposeConfiguration(cfg => new SchemaExport(cfg)

                                               .Create(true, true))

               .BuildSessionFactory();

       }

public static ISession OpenSession()

       {

               return SessionFactory.OpenSession();

       }

    }

}

There’s quite a bit going on here. .Database(MsSqlConfiguration.MsSql2008 is where we tell NHibernate to use the SQL Server driver, there are numerous others, including MySql and SQLLite which are the popular one’s I’m aware of. The .ConnectionString is obvious we’re connecting to the database we defined above.

The next bit is optional .ExposeConfiguration(cfg => new SchemaExport(cfg).Create(true,true)) tells NHibernate to actually create the tables in the database if they’re not there. We don’t really want to leave this on otherwise eachtime we run our app it’ll drop the tables with all our Cars in them and recreate them. the Create(true,true) also refers to whether to show the SQL generated to drop the tables, which we’ve turned on so we can see it work its magic.

Finally we BuildSessionFactory() which will  build the session factory and we assign it to a static variable so as to only use one Session for the lifetime of our application

Step 5:

All configuration is completed so far, now we will create a very simple webpage that prompt a user to create a table name “Car” for the first time if the table does not exist and then insert data into “Car” table.

We create a page just like below

<asp:Content ID=”Content2″ ContentPlaceHolderID=”MainContent” runat=”server”>

<p> Add Car</p>

<table>

<tr>

<td>

Title

</td>

<td>

<asp:TextBox ID=”txtTitle” runat=”server”></asp:TextBox>

</td>

<td>

Description

</td>

<td>

<asp:TextBox ID=”txtDesc” runat=”server”></asp:TextBox>

</td>

</tr>

<tr>

<td>

<asp:Button ID=”btnSave” runat=”server” Text=”Save” onclick=”btnSave_Click” />

</td>

</tr>

</table>

<asp:Label ID=”lblsatat” runat=”server” Text=”" ForeColor=”#FF5050″></asp:Label>

</asp:Content>

Step 6:

Now in the “ModelClass.cs” we will add this piece of code to add Car to the “Car” table.

public static void Add<T>(T entity)

{

           using (ISession session = OpenSession())

           using (ITransaction transaction = session.BeginTransaction())

           {

               session.Save(entity);

               transaction.Commit();

               session.Flush();

               session.Close();

           }

}

We will add an event  in the Page Class which will fire when the Save button is clicked

protected void btnSave_Click(object sender, EventArgs e)

       {

                Create(txtTitle.Text.ToString(), txtDesc.Text.ToString());

}

}

Notice we’re using the Session we just new up a Car class simply give it a name and then session.Save(entity) but note that it doesn’t actually get added to the database until you Commit the Transaction.

There’s a simple order here:

Open SessionBegin TransactionDo SomethingCommit the TransactionClose the transactionClose the SessionNow because we have a using statement we’re automatically calling Dispose on the Transaction and the session. The session.save(entity) figures out the appropriate SQL to generate for us.

Step 7:

This time we will recreate the “Car” class and create another class “Manufacturer”. We will assume that A Car has a Manufacturer and it is a One to Many relation.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using NHibernate;

using NHibernate.Linq;

namespace NHibernateTutorial

{

public class Core

{

public virtual int Id { get; set; }

}

public class Car : Core

{

       public virtual string Title { get; set; }

       public virtual string Description { get; set; }

       public virtual Manufaturer ManuFacturedBy { get; set; }

    }

public class Manufaturer : Core

{

public virtual string Name { get; set; }

}

}

Step 9:

We have to Map the classes again like below -

using System.Collections.Generic;

using System.Linq;

using System.Web;

using FluentNHibernate.Mapping;

namespace NHibernateTutorial

{

public class CarMap : ClassMap<Car>

{

       public CarMap()

       {

           Id(x => x.Id);

           Map(x => x.Title).Not.Nullable().Length(100);

           Map(x => x.Description);

           References(x => x.ManuFacturedBy).Column(“ManufacturerID”).Not.LazyLoad();

           Table(“Car”);

       }

    }

public class ManufaturerMap : ClassMap<Manufaturer>

{

       public ManufaturerMap()

       {

           Id(x => x.Id);

           Map(x => x.Name);

           Table(“Manufacturer”);

       }

}

}

Step 10:

We will write the following code to save data now-

public void Create(string carTitle, string carDesc)

{

Car cr = new Car();

cr.Title = carTitle;

cr.Description = carDesc;

cr.ManuFacturedBy = new Manufaturer { Name = this.txtMan.Text.ToString() };

ModelCode.Add<Manufaturer>(cr.ManuFacturedBy);

ModelCode.Add<Car>(cr);

       }

Here, “cr.ManuFacturedBy = new Manufaturer { Name = this.txtMan.Text.ToString() }” is initaing the “Car” object with “Manufacturer” object. While saving data we have to save the manufacturere object first then Car object.

Step 11:

Now we will retrieve data from the database. to show the data we first add a GridView named “gdvShowCar” to a newly created Webform “ShowCar.aspx”.

Now we will add a method named “Get” in out ModelCode class.

public static IList<T> Get<T>()

{

           IList<T> centers;

           using (ISession session = OpenSession())

           {

               centers = session.CreateCriteria(typeof(T))

                   .List<T>();

           }

           return centers;

       }

This method will return a list to us. the CreateCriteria() take a class  which will be queried as a parameter and return an ICriteria Object.

Now in “ShowCar.aspx.cs” we will write -

public partial class ShowCar : System.Web.UI.Page

{

       protected void Page_Load(object sender, EventArgs e)

       {

               LoadData();

       }

       public void LoadData()

       {

           IList<Car> Icar = ModelCode.Get<Car>();

           var cars = from car in Icar select new { car.Title, car.Description };

           gdvShowCar.DataSource = cars;

           gdvShowCar.DataBind();

       }

    }

This code will fill the griedview with data.

Step 12:

Now we will update data . we will first create a page named ”UpdateCar”. there we will create a drop down list of Car’s name. We will select a name from the list and update data according to this particular Car name.

<%@ Page Title=”" Language=”C#” MasterPageFile=”~/Site.Master” AutoEventWireup=”true” CodeBehind=”UpdateCar.aspx.cs” Inherits=”NHibernateTutorial.UpdateCar” %>

<asp:Content ID=”Content1″ ContentPlaceHolderID=”HeadContent” runat=”server”>

</asp:Content>

<asp:Content ID=”Content2″ ContentPlaceHolderID=”MainContent” runat=”server”>

<p> Update Car</p>

<table>

<tr>

<td>

Title

</td>

<td>

<asp:DropDownList ID=”ddlCarTitle” runat=”server” AutoPostBack=”True”></asp:DropDownList>

</td>

<td>

Description

</td>

<td>

<asp:TextBox ID=”txtDesc” runat=”server”></asp:TextBox>

</td>

</tr>

<tr>

<td>

Manufacturer Name:

</td>

<td>

<asp:TextBox ID=”txtMan” runat=”server”></asp:TextBox>

</td>

</tr>

<tr>

<td>

<asp:Button ID=”btnSave” runat=”server” Text=”Save” onclick=”btnSave_Click” />

</td>

</tr>

</table>

</asp:Content>

we did not bind data to the dropdownlist yet. To do that we will simply call the “Get” method fromModelCode class.

we can write -

protected void Page_Load(object sender, EventArgs e)

       {

           if (!IsPostBack)

           {

               initData();

           }

       }

public void initData()

{

           IList<Car> cars = ModelCode.Get<Car>();

           ddlCarTitle.DataSource = cars.ToList();

           ddlCarTitle.DataTextField = “Title”;

           ddlCarTitle.DataValueField = “Id”;

           ddlCarTitle.DataBind();

       }

The DropDownList is filled with data now. Next, we have to Load our text boxes with appropriate data. For this we will create an overloaded method of “Get” inside the “DataModel” class. this method may looks like below -

public static IList<T> Get<T>(string property, object value)

{

IList<T> centers;

using (ISession session = OpenEngineSession())

{

centers = session.CreateCriteria(typeof(T))

.Add(Restrictions.Eq(property, Convert.ToInt32(value)))

.List<T>();

}

return centers;

}

the eq() searches a match for the (property,value) pair and return a List. It works like traditional WHERE clause with a SELECT statement.

Now we will create an method in the page class named “LoadCarInfo” this method will load data on form when the DropDownList of  Name is being populated.

public void LoadCarInfo()

{

var inv = ModelCode.Get<Car>(“Id”, this.ddlCarTitle.SelectedItem.Value.ToString());

           if (inv.Count > 0)

           {

               txtDesc.Text = inv[0].Description;

               txtMan.Text = inv[0].ManuFacturedBy.Name;

           }

       }

Now , time to UpDate data. This very similar to “Add” in the ModelCode class.

We will add another method to “ModelCode”. It is very easy and understandable.

public static void Update<T>(T entity)

{

           using (ISession session = OpenSession())

           using (ITransaction transaction = session.BeginTransaction())

           {

               session.Update(entity);

               transaction.Commit();

               session.Flush();

               session.Close();

           }

       }

So now we can call this “Update” from our Page Class as before-

protected void btnSave_Click(object sender, EventArgs e)

{

var inv = ModelCode.Get<Car>(“Id”, this.ddlCarTitle.SelectedItem.Value.ToString())[0];

           inv.Description = txtDesc.Text;

           inv.ManuFacturedBy.Name = txtMan.Text;

           ModelCode.Update<Manufaturer>(inv.ManuFacturedBy);

           ModelCode.Update<Car>(inv);

       }

Step 13:

Now we will Delete data. We will add another method in “ModelCode”.

public static void Remove<T>(T entity)

{

using (ISession session = OpenEngineSession())

using (ITransaction transaction = session.BeginTransaction())

{

session.Delete(entity);

transaction.Commit();

session.Flush();

session.Close();

}

}

Conclusion:

Here I have tried to given some basic CRUD operation using NHibernate and FluentNHibernate. Many thing is left and overlooked intentionally because the limitation of my scope. Actually It takes time to be expert and skilled with these technology.

DownLoad FullCode.

 


৩০তম বিসিএস লিখিত পরীক্ষার ফল প্রকাশ

Posted by imomins on June 2, 2011 at 9:32 AM Comments comments (1)

ঢাকা : ৩০তম বিসিএস লিখিত পরীক্ষার ফল প্রকাশ করা হয়েছে। বৃহস্পতিবার বিকেলে এই ফল প্রকাশ করা হয়।

সাধারণ ক্যাডারে উত্তীর্ণ হয়েছেন ৪ হাজার ১৯ জন, জেনারেল ও কারিগরি ক্যাডারে ৩ হাজার ৬৩১ জন এবং শুধু কারিগরি ক্যাডারে ১ হাজার ৪০০ জন।

৩০তম বিসিএসের মাধ্যমে ২ হাজার ৫৭২ জনকে নিয়োগের সুপারিশ করবে পিএসসি। এদের মধ্যে সাধারণ ক্যাডারে ৮৩১ জন এবং কারিগরি ক্যাডারে ১ হাজার ৭৪১ জন।

পাবলিক সার্ভিস কমিশনের (পিএসসি) পরীক্ষা নিয়ন্ত্রক (ক্যাডার) আ ই ম নেছার উদ্দিন বাংলানিউজকে এ তথ্য জানান।আগামী ২০ জুন থেকে উত্তীর্ণদের মৌখিক পরীক্ষা গ্রহণ শুরু করবে পিএসসি। মৌখিক পরীক্ষার সময়সূচি পরে জানানো হবে।

এবার প্রার্থীদের ২০০ নম্বরের মৌখিক পরীক্ষা নেওয়া হবে। এর আগে ১০০ নম্বরের মৌখিক পরীক্ষা হয়।জানুয়ারি মাসে এ লিখিত পরীক্ষা অনুষ্ঠিত হয়। এর আগে গত বছরের ৩০ জুলাই প্রিলিমিনারি পরীক্ষা অনুষ্ঠিত হয়।

তথ্যবিভ্রাট ও প্রশাসনিক কারণে ৩৪ জন প্রার্থীর ফল প্রকাশ স্থগিত রেখেছে পিএসসি।

স্থগিত থাকা প্রার্থীদের রেজিস্ট্রেশন নম্বর- ০০৩৩৬২, ০৩০২৮৬, ০৩১৭৭০, ০৩২১০৪, ০৩২১৩৩, ০৩২১৩৫, ০৩৩২৩৪, ০৪১৬৩০, ০৪৮৮০৯, ০৫৪০৫৭, ০৭০৭৩১, ০৭৫২১৪, ০৭৮১৮০, ০৭৮২২০, ০৭৮২২২, ০৭৮৪৫৩, ০৭৮৬৮১, ০৮১৪৫৭, ০৮৬০৯৩, ০৮৮৯০৭, ০৮৯৬৭৬, ০৮৯৬৭৮, ০৯৯০২০, ০৯৯৫৪৬, ০৯৯৬২০, ১০০০১৫, ১০০৪১৯, ১০০৪২১, ১০১৯১৯, ২০৫৩৮০, ২১১৬১০, ৩১০০৫২, ৩১২৯৬৮ ও ৪০০৩৭১।

এ ফলাফলকে সাময়িক ফল উল্লেখ করে পিএসসি জানায়, ‘কোনও ক্ষেত্রে চাহিদাকৃত কাগজপত্রাদির ঘাটতি থাকিলে বা পরবর্তীকালে কোনও সময় কোনও প্রার্থীর যোগ্যতার ঘাটতি ধরা পড়িলে, দুর্নীতি, অসত্য তথ্য প্রদান বা আবেদনপত্রে গুরুতর ত্রুটি বা ঘাটতি দেখা গেলে বা প্রদত্ত তথ্য মিথ্যা হইলে মৌখিক পরীক্ষার পূর্বে বা পরে যে কোনও পর্যায়ে উক্ত প্রার্থীর প্রার্থিতা বাতিল হইবে।’

ফলাফল পেতে এখানে ক্লিক করুন 


ফেসবুকের স্ট্যাটাস মুঠোফোনে

Posted by imomins on May 30, 2011 at 8:26 AM Comments comments (0)

ফেসবুকের নোটিফিকেশনসসহ সবকিছুর খবর বিনামূল্যে মুঠোফোনেই জানা যায়। এ জন্য প্রথমে ফেসবুকে ঢুকে (লগ-ইন) ওপরে ডান পাশের Account থেকে Account Settings-এ গিয়ে ওপরে Mobile-এ ক্লিক করুন অথবা www.facebook.com/mobile/?settings ঠিকানায় যান। এখন Register for Facebook Text Messages -এ ংকে ক্লিক করুন। Mobile Carrier-এ বাংলালিংক, সিটিসেল, এয়ারটেল বা রবি নির্বাচন করে Next-এ ক্লিক করুন। আপনার মুঠোফোন থেকে F লিখে 32665-এ বার্তা (এসএমএস) পাঠান। ফিরতি বার্তায় আপনার কাছে একটি কোড নম্বর আসবে, সেটি কোড বক্সে লিখুন। মুঠোফোনের নম্বরটি আপনার ফেসবুক প্রোফাইলে যোগ করতে না চাইলে Add this phone number to my profile বক্স থেকে টিক চিহ্ন তুলে দিয়ে Next-এ ক্লিক করুন। আর গ্রামীণফোন ব্যবহারকারীরা গ্রামীণফোন থেকে Fb লিখে 2555 নম্বরে মেসেজ পাঠান। ফিরতি মেসেজে আপনার কাছে একটি কোড নম্বর আসবে।

এখন www.facebook.com/mobile/?settings ঠিকানা থেকে Already received a confirmation code? লিংকে ক্লিক করে কোড নম্বরটি কোড বক্সে লিখে Confirm-এ ক্লিক করুন (গ্রামীণফোনের ক্ষেত্রে আপনার মুঠোফোনের নম্বরটি আপনার ফেসবুক প্রোফাইলে যোগ হয়ে যেতে পারে, বাদ দিতে চাইলে ফেসবুক প্রোফাইল থেকে ইনফোয় গিয়ে এডিটে ক্লিক করে বাদ দিতে পারবেন)।

এখন কোন কোন নোটিফিকেশন মুঠোফোনে পেতে চান, সেগুলো নির্বাচন করুন। আরও বিস্তারিতভাবে দেখে নির্বাচন করতে চাইলে Which text notifications should go to my phone?-এর নিচে Click here-এ ক্লিক করুন। এখন Whose status updates should go to my phone?-এর নিচের বক্সে আপনার ফেসবুক বন্ধুদের নাম লিখুন। যাদের নাম লিখবেন, তারা যখন ফেসবুকে নতুন স্ট্যাটাস দেবে, তখন সেই স্ট্যাটাসটি মেসেজ হয়ে আপনার মুঠোফোনে আসবে এবং এর জন্য কোনো টাকা লাগবে না।

 


How to Update Existing data by comparing lenth in C#

Posted by imomins on May 30, 2011 at 6:01 AM Comments comments (0)

 

private void mprivUpdateStockItemCodeRelatedRecord()

{

string lstrNewStockItemCode;

if (clsDatabaseConnector.gmpubstasqlconnSQLConnection.State == ConnectionState.Open)

{

clsDatabaseConnector.gmpubstasqlconnSQLConnection.Close();

}

clsDatabaseConnector.gmpubstasqlconnSQLConnection.Open();

 

//OPEN TEMPORARY CONNECTION

if (clsDatabaseConnector.gmpubstasqlconnSQLConnectionTemp.State == ConnectionState.Open)

{

clsDatabaseConnector.gmpubstasqlconnSQLConnectionTemp.Close();

}

clsDatabaseConnector.gmpubstasqlconnSQLConnectionTemp.Open();

 

string lstrQuery = "SELECT STOCKITEM_CODE FROM INV_STOCKITEM WHERE STOCKITEM_CODE <> 'NULL' ORDER BY STOCKITEM_CODE";

SqlCommand thisCommand = new SqlCommand(lstrQuery, clsDatabaseConnector.gmpubstasqlconnSQLConnection);

SqlDataReader thisReader = thisCommand.ExecuteReader();

 

while (thisReader.Read())

{

lstrNewStockItemCode = null;

string lstrOldStockItemCode = Convert.ToString(thisReader["STOCKITEM_CODE"]);

 

if (lstrOldStockItemCode != "As Per Details")

{

string[] oldSplitedCode = lstrOldStockItemCode.Split('.');

 

foreach (string splitedCode in oldSplitedCode)

{

if (splitedCode.Length == 2)

{

lstrNewStockItemCode += "0" + splitedCode + ".";

}

else if (splitedCode.Length > 2)

{

lstrNewStockItemCode += "00" + splitedCode;

}

}

 

string lstrUpdateQuery = "UPDATE INV_STOCKITEM SET STOCKITEM_CODE = '" + lstrNewStockItemCode + "' WHERE STOCKITEM_CODE = '" + lstrOldStockItemCode + "'";

lstrUpdateQuery += "; UPDATE ACC_SALES_PRICE_SETTING_CHILD SET STOCKITEM_CODE = '" + lstrNewStockItemCode + "' WHERE STOCKITEM_CODE = '" + lstrOldStockItemCode + "'";

lstrUpdateQuery += "; UPDATE INV_TRAN_CHILD SET STOCKITEM_CODE = '" + lstrNewStockItemCode + "' WHERE STOCKITEM_CODE = '" + lstrOldStockItemCode + "'";

lstrUpdateQuery += "; UPDATE INV_SL_NO_WISE_STOCK_DETAILS SET STOCKITEM_CODE = '" + lstrNewStockItemCode + "' WHERE STOCKITEM_CODE = '" + lstrOldStockItemCode + "'";

lstrUpdateQuery += "; UPDATE INV_LC_OR_WORK_ORDER_CHILD SET STOCKITEM_CODE = '" + lstrNewStockItemCode + "' WHERE STOCKITEM_CODE = '" + lstrOldStockItemCode + "'";

lstrUpdateQuery += "; UPDATE TAA_TARGET_SETTING_CHILD SET STOCKITEM_CODE = '" + lstrNewStockItemCode + "' WHERE STOCKITEM_CODE = '" + lstrOldStockItemCode + "'";

 

SqlCommand thisCommandTemp = new SqlCommand(lstrUpdateQuery, clsDatabaseConnector.gmpubstasqlconnSQLConnectionTemp);

thisCommandTemp.ExecuteNonQuery();

}

}

thisReader.Close();

clsDatabaseConnector.gmpubstasqlconnSQLConnectionTemp.Close();

clsDatabaseConnector.gmpubstasqlconnSQLConnection.Close();

}

 

 

 

 

 

mprivUpdateStockItemCodeRelatedRecord();


Upper Case First Character in a Text using C#

Posted by imomins on May 30, 2011 at 5:21 AM Comments comments (0)

 

public static string UppercaseFirst(string text) //using ToCharArray; it is faster than traditional way

{

if (text.Length > 0)

{

char[] a = text.ToCharArray();

a[0] = char.ToUpper(a[0]);

return new string(a);

}

else

return "";

}


কিছু সাংঘাতিক(!)

Posted by imomins on May 29, 2011 at 1:20 AM Comments comments (0)

(১)২ এর সকল অঋনাত্নক ঘাতের যোগফল

মনে করি ২ এর সকল অঋনাত্নক ঘাতের যোগফল x

x = 2^0+2^1+2^2+2^3+……………….

= 1+2+4+8+……………..       (1)

2x = 2+4+8+16+……………   (2)

(2) নং থেকে(1) নং বিয়োগ করে পাই

2x-x= (2+4+8+16………..)-(1+2+4+8+……..)

x = -1

1+2+4+8+16+…………. = -1

হায় হায় ইহা আমি কি দেখিলাম !!!!!!!!!!!!!!

(২) ধনাত্নক পূর্ণ সংখ্যার যোগফল ঋনাত্নক

মনে করি S= 1+2+3+4+...................

A=1-2+3-4+................

তাহলে S+A=(1+1)+(2-2)+(3+3)+(4-4)+...........

=2+6+10+14+.......

=2+(2+4)+(2+8)+(2+12)+..........

=(2+2+2+2+.......)+(4+8+12+.........)

=(2+2+2+2+.......)+4(1+2+3+.......)

=(2+2+2+2+.......)+4S   (1)

এবং  S-A  =(1-1)+(2+2)+(3-3)+(4+4)

=4+8+12+16+..........

=4(1+2+3+4+..........)

=4S                                 (2)

(1) ও (2) নং যোগ করে পাই

2S =  8S+ (2+2+2+2+.......)

বা, 6S = - (2+2+2+2+.......)

S  = - (1/6) (2+2+2+2+.......)

ডানদিকের রাশি নিঃসন্দেহে ঋনাত্নক .....

অর্থাৎ সকল  ধনাত্নক পূর্ণ সংখ্যার যোগফল ঋনাত্নক !!!!!!!!!!!!!!!!!!

কেন এমন হলো তা না হয় R একদিন বলব

আচ্ছা এবার একটি সহজ প্রশ্ন

A= R-{2,3,4}

B= R-{4,5}

AUB=?  (U=union)

AnB=?   (n=intersection)

A-B=?

সবাই অন্তত সহজ প্রশ্নের উত্তর দিলে খুশি হব

Read more: http://techtunes.com.bd/sci-tech/tune-id/72740/#ixzz1NiRl6TIY

 


ঐতিহাসিক সোনামসজিদ

Posted by imomins on May 23, 2011 at 1:02 AM Comments comments (0)

চাঁপাইনবাবগঞ্জ শুধু আম, কাঁসা-পিতল, রেশম ও লাক্ষার জন্য বিখ্যাত নয়। এখানে রয়েছে ঐতিহাসিক বিভিন্ন স্থাপনা। স্থাপনাগুলোর মধ্যে ঐতিহাসিক সোনামসজিদ একটি অন্যতম নিদর্শন। যা জেলার পরিচিতিকে শুধু বাংলাদেশেই নয়, বিশ্বের অধিকাংশ স্থানে বিস্তৃত করেছে। জেলা শহরের প্রায় ৩৫ কিলোমিটার দূরে পশ্চিম কোণে ভারত সীমান্তের কাছাকাছি অবস্থিত ইসলামী প্রাচীন নিদর্শন হচ্ছে এই সোনামসজিদ। এর প্রতিষ্ঠা সংক্রান্ত প্রকৃত তথ্য অর্থাৎ নির্মাণের সন-তারিখ নিয়ে এখনো বিতর্ক রয়েছে। এই মসজিদের সামনের মধ্য দরজার উপর দিকে অবস্থিত শ্বেতপাথরে হোসেন শাহ নামটি লেখা থাকায় অনুমান করা যায় যে, এটি সুলতান আলাউদ্দিন হোসেন শাহর শাসন আমলেই নির্মিত হয়। তার শাসনকাল ছিল ১৪৯৩ খ্রিস্টাব্দ থেকে ১৫১৯ খ্রিস্টাব্দ অর্থাৎ হিজরি ৮৯৯ থেকে ৯২৫ পর্যন্ত। তবে এই মসজিদটি নির্মাণের ব্যাপারে ভিন্ন ভিন্ন তথ্য পাওয়া যায়। যেমন _ ১. হোসেন শাহর শাসনকালের মধ্যে আরবি কোনো এক সনের ১৪ তারিখে জনৈক ওয়ালী মুহাম্মদ এটি নির্মাণ করেন। ২. জনৈক নপুংসক কর্তৃক এ সোনামসজিদ নির্মিত হয়েছিল এবং আলাউদ্দিন হোসেন শাহর দরবারে কর্মরত কোনো কর্মচারী বা কোষাধ্যক্ষ কর্তৃক সোনামসজিদ প্রতিষ্ঠা লাভ করেছিলেন। ৩. এক প্রহর মতান্তরে সোয়া প্রহর (৩ ঘণ্টায় ১ প্রহর) এই এলাকায় আকাশ থেকে সোনা বর্ষিত হয়েছিল বলে মসজিদের নাম সোনামসজিদ হয়ে যায়। ৪. জনৈক ব্যক্তি অলৌকিকভাবে প্রচুর সোনা পেয়ে সে সোনার অর্থ দিয়ে এ মসজিদ নির্মাণ করে দেন বলে এর নামকরণ সোনামসজিদ হয়। ৫. জিন কর্তৃক সোনা দিয়ে এক রাতেই মসজিদটি নির্মাণ করা হয়েছিল বলে এর নাম সোনামসজিদ হয়ে যায়। এ মতানুসারীরা এও বিশ্বাস করেন যে, কেউ এ মসজিদের কোনো এক অংশের সোনার খণ্ড চুরি করে নেয় বলে আল্লাহর তরফ থেকে পরে তা ইট-পাথরে পরিণত হয়। যদিওবা এ মতটি অত্যন্ত দুর্বল। ৬. বিশেষ কারুকার্য খচিত অনেক মূল্যবান পাথর দিয়ে মসজিদটি নির্মাণ করতে অনেক অর্থ ব্যয় হয়েছিল, যা তৎকালীন সোনার মূল্যের চেয়ে কোনো অংশে কম ছিল না বলে উপমিত করে এর নাম রাখা হয় সোনামসজিদ। আবার অনেকে বলেন, মসজিদের ভেতর ও বাইরে অনেক আলোক বিকিরণকারী শ্বেতপাথর ছিল, যার আলোকচ্ছটায় মসজিদের ভেতরসহ বাইরের দিকও সব সময় সোনার মতো উজ্জ্বল থাকত। এজন্য এর নামকরণ সোনামসজিদ। তবে যত মতান্তরই থাকুক না কেন, মধ্যযুগে নির্মিত এ সোনামসজিদটি কালের সাক্ষী হয়ে অনেক কিংবদন্তি নিয়ে আজও চাঁপাইনবাবগঞ্জ জেলার খ্যাতি ও সুনাম অক্ষুণ্ন রেখে চলেছে। এই স্থাপনার গুরুত্ব স্মরণ করিয়ে দেয় প্রাচীন বাংলার রাজধানী গৌড়ের কথাকে। কারণ গৌড় বাংলার রাজধানী না হলে অভিনব এই শিল্পকলার আবির্ভাব ঘটত না। সব মিলিয়ে প্রাচীন রাজধানী গৌড়ের পাদপীঠে অবস্থিত সোনামসজিদের স্থাপত্যকলার নিদর্শনগুলো জেলাকে করেছে সমৃদ্ধ ও গৌরবান্বিত। তবে জেলার অধিকংশ প্রাচীন ঐহিত্যের ভাণ্ডারই হচ্ছে প্রাচীন গৌড় বা বর্তমানের সোনামসজিদ এলাকা। এই এলাকার ইসলামী শিল্পকলার নিদর্শনগুলো মুসলমানদের চেতনাকে আজও উদ্দীপিত করে চলেছে। এগুলো হলো দারুসবাড়ী মসজিদ, ধানইচকের মসজিদ, হজরত শাহ নেয়ামাতুল্লাহ (র.)-এর মাজার, শাহ সুজার দোতলা বাড়ি ইত্যাদি। সোনামসজিদের ঐতিহ্য ও এলাকার পুরাকীর্তি নিয়ে পরবর্তী শব্দগুলোর ইতিহাসবিদসহ বর্তমান যুগের অনেক গবেষক ও লেখক অনেক মূল্যবান তথ্যসমৃদ্ধ ও ঐতিহাসিক প্রবন্ধ লিখেছেন। এসব তথ্য জানার আগ্রহ ও ইচ্ছা কালে কালে মানুষের মনে নতুন প্রেরণা যুগিয়ে চলেছে।

সোনামসজিদের গঠনশৈলী হচ্ছে বাইরে সীমানাসহ দৈর্ঘ্য ৮২ ফুট ও প্রশস্ত সাড়ে ৫২ ফুট। ছাদ সমতল বরাবর এর উচ্চতা প্রায় ২৫ ফুট এবং ছাদের উপরে শোভিত গম্বুজগুলোর ব্যাস প্রায় ৩০ ফুট এবং পাথর দিয়ে এর দেয়ালের প্রকোষ্ঠে ছোট ইটের গাঁথুনি এবং বাইরের দিক মসৃণ ও হালকা কারুকার্য পাথর দিয়ে গেঁথে ইটগুলোকে আবৃত করা হয়েছে। পাথরগুলো গ্রুপ কেটে একটির সঙ্গে আর একটিকে অত্যন্ত মজবুত করে সংযুক্ত করা আছে। দেয়ালের ভেতর অংশেও কারুকার্য খচিত পাথর দিয়ে ইটগুলোকে ঢেকে দেওয়া হয়েছে। তাই এ সোনামসজিদের চারদিকের দেয়ালের পুরুত্ব ইট-পাথর মিলিয়ে প্রায় ৬ ফুট দাঁড়িয়েছে। মসজিদের ভেতরে প্রবেশের জন্য সম্মুখভাগে একই মাপের ৫টি দরজা রয়েছে। এ দরজাগুলোর উচ্চতা ও প্রবেশপথের দৈর্ঘ্য প্রায় ১১ ফুট ও সাড়ে ৪ ফুট। এছাড়াও মসজিদের উত্তর-দক্ষিণ দেয়ালেও ৩টি করে ৬টি দরজা আছে। এগুলো উচ্চতার দিক দিয়ে সামনের দিকের সমান হলেও প্রবেশপথের দৈর্ঘ্যের চেয়ে কম। তবে উত্তরের ৩টির মধ্যে একটিতে প্রবেশের স্থলে বাইরের দিকে একটি সিঁড়ি থাকায় তার উচ্চতা সব দরজার চেয়েও বেশি। ইমামের নামাজ পড়া বা খোতবা আদায়ের জন্য মসজিদ গঠনের নিয়ম অনুযায়ী পশ্চিম দেয়ালের মাঝ অংশে একটি কেন্দ্রীয় মেহরাব রয়েছে। এছাড়াও পাশে দুটি করে আরও ৪টি মেহরাব আছে। মসজিদের ভেতর প্রবেশ করার জন্য সামনে একটি তোরণ রয়েছে এবং মসজিদের ছাদে রয়েছে ১৫টি গম্বুজ। গম্বুজের ভেতর অর্থাৎ নিম্নাংশে বাংলার প্রকৃতির অসংখ্য বৈচিত্র্যময় ফল, ফুল, লতা-পাতা, শাখা গুচ্ছ দিয়ে নকশি কাঁথার মতো এমনভাবে সৌন্দর্যমণ্ডিত করা হয়েছে, যা দেখে অনুমান করতে কষ্ট হয় না যে, এগুলোর নকশা প্রণেতা শিল্পীরা এ কাজে অত্যন্ত সিদ্ধহস্ত ছিলেন।

 


Website Validiting in C#

Posted by imomins on May 16, 2011 at 8:37 AM Comments comments (0)

if (txtWebsite.Text != "")

                {

                    if (!isWeb(txtWebsite.Text))

                    {

                        MessageBox.Show("Please Enter Valid Website Name");

                        txtWebsite.Focus();

                        txtWebsite.SelectAll();

                    }

                    else

                    {

                        txtEmail.Focus();

                        txtEmail.SelectAll();

                    }

                }

                else

                {

                    txtEmail.Focus();

                    txtEmail.SelectAll();

                }

 

 

 

 

public static bool isWeb(string inputWebsitel)

        {

            return Regex.IsMatch(inputWebsitel,@"^(((ht|f)tp(s?))\://)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&amp;%\$#\=~_\-]+))*$");

 

        }

 


ফেসবুক চালু করলো টু-ফ্যাক্টর ভেরিফিকেশন স&#24

Posted by imomins on May 15, 2011 at 6:34 AM Comments comments (0)

গুগলের পর এবার ফেসবুক টু-ফ্যাক্টর ভেরিফিকেশন বা অথেনটিকেশন চালু করলো। বাংলাদেশে গুগলের টু-ফ্যাক্টর ভেরিফিকেশন সমর্থন না করলেও ফেসবুকেরটা সমর্থন করে। ফলে ফেসবুকে লগইনের সময় পাসওয়ার্ড ছাড়াও মোবাইলে প্রাপ্ত কোড দ্বারা লগইন সম্পন্ন করা। এর ফলে ফেসবুক অ্যাকাউন্ট হ্যাক হওয়া থেকে ব্যবহারকারী রেহায় পাবে।

টু-ফ্যাক্টর চালূ করার জন্য ফেসবুকে লগইন করে Account > Account Settings > Settings > Account Security থেকে Login Approvals এর Require me to enter a security code sent to my phone চেক করতে হবে। এবার Next বাটনে ক্লিক করে মোবাইলে প্রাপ্ত কোড লিখে Next করতে হবে এবং Save বাটনে ক্লিক করে করতে হবে। যদি কোন মোবাইল যুক্ত করা না থাকে তাহলে যুক্ত করতে হবে।

এরপর থেকে ফেসবুকে নতুন কোন ডিভাইস (কম্পিউটার) লগইন করতে গেলে মেবাইলে একটি এসএমএস (কোড) আসবে। উক্ত কোড দিয়ে লগইন সম্পন্ন করতে হবে। অন্যথায় ফেসবুকে লগইন করা যাবে না।

 



Rss_feed