Simplest Chat Application in 5 minutes

 

Hello friends,
Yesterday night just wondering on net, I just found a interesting control which is JAXTER Chat Control.

So I just went on the site and download trial version from site URL.

http://www.webfurbish.com/

I really like this control it’s easy to use with your asp.net code.

It provides many themes you can use and one of them.

I really like what ever it does. It’s really good control.

Just visit below link for enjoying the control.

http://indiandotnetnewchat.tk/ 

And if you like these controls then buy from site

http://www.webfurbish.com/

ThanksEnjoy coding  , enjoy new things.

Rajat Jaiswal

Advertisements

Introduction of Microsoft Chart control in 5 minutes Part -Ist

 

Hello Friends,

If you have ever work on Data warehousing project or any project which is related with MIS then you know what is need of Graphs.

As a programmer we really need to know how to show up the graphs. As graphs are useful in Data analysis as you people know and our customer many time demanding this.

For example. The need yearly comparisons of production stock need over all profit comparison.

Earlier for this we use Dundas charting control one of the finest control. Or many more available in market but now Microsoft announced same charting capable tool which is Ms Chart control

Especially very helpful with AJAX.

It’s easily available and for the most it’s free.

Below are the sites from where you can download the MS chart control.

 

 

http://www.microsoft.com/downloads/details.aspx?FamilyId=130F7986-BF49-4FE5-9CA8-910AE6EA442C&displaylang=enI know you people eager to see example of it. But sorry folk this time I am in party this weekend so could not completed the example for this time but soon I am with the several example of Ms Chart control

And in next week defiantly with I will provide you chart control example and how to use it tutorial.

Till that time

Enjoy programming

Thanks

Rajat

 

5 Ways in 5 minutes to find 2nd highest Salary Or 2nd minimum Salary

Hello friends,

Today’s post is for all new bibes going for interview and scarred of sql query question how to determine 2nd highest or 2 nd lowest salary.

Or we can say nth highest or lowest salary for this I will provide you some basic Sql suppose.

DECLARE @tblEmployeeSalary TABLE(lngEmployeeId INT, strEmpName VARCHAR(100), fltBasicSalary FLOAT)

INSERT @tblEmployeeSalary SELECT 1,’RAJAT’,345345

INSERT @tblEmployeeSalary SELECT 2,’ASHISH’,76845

INSERT @tblEmployeeSalary SELECT 3,’KAPIL’,234545

INSERT @tblEmployeeSalary SELECT 4,’KAMLESH’,74564

INSERT @tblEmployeeSalary SELECT 5,’RAVI’,56756456

INSERT @tblEmployeeSalary SELECT 6,’SHIV’,75675

INSERT @tblEmployeeSalary SELECT 7,’MONICA’,76566

INSERT @tblEmployeeSalary SELECT 8,’PIYUSH’,58776

INSERT @tblEmployeeSalary SELECT 9,’KUNAL’,345567

INSERT @tblEmployeeSalary SELECT 10,’MANISH’,76766

1) The below query is simplest query for finding 2nd minimum salary.if you want 2nd maximum salary then

you have to just change the order by fltbasicSalary desc.

SELECT MAX (fltBasicSalary)

FROM @tblEmployeeSalary

WHERE fltBasicSalary IN (SELECT DISTINCT TOP 2 fltBasicSalary

FROM @tblEmployeeSalary

ORDER BY fltBasicSalary ASC)

2) This bit complex then first one in that you have to change condition of where clause for min /max

according to your requirment. if you want nth highest or lowest salary then just replace 2 by

that particular number which you want.

SELECT MIN(fltBasicSalary)

FROM @tblEmployeeSalary e1

WHERE 2 <=(SELECT COUNT(*)

FROM @tblEmployeeSalary e2 WHERE e1.fltBasicSalary >= e2.fltBasicSalary);

3) This is simple one but restriction is it require SQL SERVER 2005 it will not work on SQL server 2000

actually in sqlserver 2005 we have Rank, Row_Number(), Dens_Rank() function by utilizing then we can ,

give a row rank or number. i am using that concept.

 

SELECT tmp.fltBasicSalary

FROM (SELECT DISTINCT fltBasicSalary ,

ROW_NUMBER()OVER (ORDER BY fltBasicSalary ASC) As intRowNumber

FROM @tblEmployeeSalary)tmp

WHERE tmp.intRowNumber = 2

4) In same way we can use Rank and dens rank

SELECT tmp.fltBasicSalary

FROM (SELECT DISTINCT fltBasicSalary ,

RANK()OVER (ORDER BY fltBasicSalary ASC) As intRowNumber

FROM @tblEmployeeSalary)tmp

WHERE tmp.intRowNumber = 2

5) This is another way of getting max or min salary by a group by statement

SELECT TOP 1 fltBasicSalary

FROM (SELECT TOP 2 fltBasicSalary

FROM @tblEmployeeSalary

GROUP BY fltBasicSalary ORDER BY fltBasicSalary ASC) AS tmp ORDER BY fltBasicSalary DESC

I hope you people like it.

if you find any problem in that feel free to ask…

enjoy SQL server.

enjoy programming

Thanks

Rajat

 

Discussion Board a Chat Page with in 5 minutes

 

Hello friends,

Today I will describe here how make your own discussion board where your friends can chat. Its fare simple job. For this you need only three things basic.

1) meta tag

2) Application variable

3) Frameset tag 

I know you people are aware of application variable. Application variable is the variable which is common to all user on site.

So what I did I keep all the message in application variable and show it on the message screen.

And when ever a user send a message I keep that message in application variable.

I refresh the message page in regular interval so that message screen will update with latest message.

The refresh technique is fairly simple its just use of meta tag.

<meta http-equiv=”refresh” content=”5″ />

The above tag refresh my page in each 5 second.

Main page is has following tags

<frameset rows=”60%,40%”>

<frame src=”Messages.aspx”>

</frame>

<frame src=”SendMessage.aspx”>

</frame>

</frameset>

</html>

Where Message.aspx is used to collect all message which are in application variable.

And sendMessage.aspx is used to send or we can say store all message in Application variable.

One important thing to remember here is to lockout and unlock application when ever you want to save message in application variable.

The reason behind is when a use update application variable then other user can not change that variable.

For more information you can download & test this chat program at

 

http://indiandotnetdiscussionboard.tk/Happy Programming

 

WebSite available on search engine 2 simple technique

Hello Friends,
Today I will give you hint how to make your website  search engine compatible.
Most of the time we have problem how we make our web site so efficient so that it will easily available in search engine like Google, yahoo and msn.
Here I am with two tips which help you in this basic so try it and enjoy it.
1) First thing is a use META tag in your web pages for example
<META NAME=”keywords” CONTENT=”Rajat Jaiswal, Asp.net & Sql server, web Developer, Indian dot net, Sql server fundas”>
<META NAME=”robots” CONTENT=”FOLLOW, INDEX”>
2) You have to follow below URLs and link up your web site over it. 
https://siteexplorer.search.yahoo.com/Submit
http://www.google.com/addurl/?continue=/addurl
http://search.msn.com/docs/submit.aspx

I hope the above 2 option will help you in your need.

So make your web site available on this search engines.

Enjoy programming 🙂
Thanks …

Language Translator in 5 minutes

 

 

Hello friends,

Today we will learn google’s a unique and very powerfull utility which is language translator.

Its very powerful tool which is provided by google.I just used javascript provided by google.

We used

 

google.load(“language”, “1”);This will load version 1 of language script.

We just use google initialize function which will tranlate our text to desire language.

I have uploaded the example.

At

 

http://languagetranslatorofindiandotnet.tk/Its just a sample you can further go with google apis which is freely available.

So enjoy things , enjoy programming

Pivot in SQL SERVER

Hello friends,

Today I will explain you how to use pivot table. It’s very useful.

For example just take  a look on below   statements

 

DECLARE @tblTest AS TABLE (strName        VARCHAR(50),

                           fltTotalAmount DECIMAL(10,3),

                           intMonth       TINYINT,

                           intYear        INT)

 

INSERT INTO @tblTest (strName, fltTotalAmount, intMonth, intYear)

VALUES (‘RAJAT’, ‘10000’,1,2006)

INSERT INTO @tblTest (strName, fltTotalAmount, intMonth, intYear)

VALUES (‘RAJAT’, ‘15000’,2,2006)

INSERT INTO @tblTest (strName, fltTotalAmount, intMonth, intYear)

VALUES (‘RAJAT’, ‘16000’,3,2006)

INSERT INTO @tblTest (strName, fltTotalAmount, intMonth, intYear)

VALUES (‘RAJAT’, ‘10700’,1,2007)

INSERT INTO @tblTest (strName, fltTotalAmount, intMonth, intYear)

VALUES (‘RAJAT’, ‘16000’,2,2007)

 

Now suppose if you want sql result in following format

Name

Year  

Jan         

Feb       

march

RAJAT

2006

10000.000

15000.000

16000.000

RAJAT

2007

10700.000

16000.000

NULL

  Then what you have to do?

You have to do following thing just take a look below statements.

 

SELECT strName,

       intYear,

       [1] As Jan,

       [2] AS Feb,

       [3] As mar

FROM ( SELECT strName,

       intYear,

       fltTotalAmount,

       intMonth

       FROM @tblTest )p

PIVOT (SUM (fltTotalAmount) FOR intMonth IN ([1],[2],[3]))Q

 

Now when you execute it it will give you desire result.

 

I hope you got the idea how to use pivot table.

If you have any kind of problem or confusion in the above statement feel free to drop a comment.

Thanks

Regards

Rajat Jaiswal

 

 

 

 

 

 

 

Basic Ado.net Data Services 5 minutes job Part -I

 1. What is Ado.net Data Services ? 

 

http://msdn.microsoft.com/en-us/vstudio/cc533448.aspx

 

 Ado.Net Services formaly known as “Astoria“. It’s a facility that is used as a web services over net just like simple http with well known data format like jason or XML.

It’s a feature that allow user to mainuplate, traverse data through simple URIs. This allow easy access of data. The concept comes from general programming concept reffered as REST.It is avalilable with Vs 2008 + SP1.According to me I found only one and most important point that it is easily navigate through url.

Which is best feature.

2. What  it requires to run it ?

 

For this you have to install vs2008’s service pack 1 which is easily available at

 

 

 

 

3) Basic  Example for understanding :-

 

System.Data.Services

Here I am going to explain an example just follow the same way for initital starting. Just follow below step.

Step 1:-

Add new web project

Step 2:- Now add a new item “Ado.net Data Service” as shown in below fig when you add it. It adds a new item in your project just like I added “RajatDataService.svc

 

AddAdoNetService

 

By default you get shared method which is initializeService

Step3:- Add new item Ado.net Entity model as shown in below fig.

 

addmodelentity

 

Once you add it then you will get screen like below fig it has edmx extention.

 

entitymodel

Before going further I just explain you in breif edmxAdo.net entity model ” is just like Your linq mapper with extended functionality I will explain this later on in my new

Post. But for current point of time just think as ORM.

Step4 :- Once you done with this you have to do following code in your DataService.svc.vb file’s default shared method as we said in step 2

 

Imports 

 

 

Imports System.Linq

Imports System.ServiceModel.Web 

Public Class RajatAdoNetService 

 

 

 

 

    Inherits DataService(Of MedicalProEntities)

 

 

 

 

‘The medical proEntries is your model entry class

 

 ‘ This method is called only once to initialize service-wide policies.

 

 Public Shared Sub InitializeService(ByVal config As IDataServiceConfiguration) 

 

‘ TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.

 

 

 config.SetEntitySetAccessRule(“*” , EntitySetRights.AllRead) 

 

‘ above line is use for access rules for entities in model

 

 

 

 ‘if you want to access particular entity (table) from database then just give entity name at the place of * like below

 

 ‘ config.setEntitySetAccessRules(“tblProduct”,entitySetRight.allRead)

 

 ‘ The second option is for mainly giving rights like , read ,write,delete etc on entity set

 config.SetServiceOperationAccessRule(“*”, ServiceOperationRights.All) 

 

 

 

‘ The above line is service opration accessRules in this again just put * int first parameter, and all in second parameter

 End Sub

End  Class

 

 

Once you done with above code just set your .Svc page as set as start page and run the application. And you will be supprise you will get below screen

 

http://localhost:3120/RajatAdoNetService.svc/)

 

svc
You will find in the above fig that all the tables are with in xml format. URL (
Now suppouse you want to access particular table database then you have to write fllowing url in addressbar

 

http://localhost:3120/RajatAdoNetService.svc/tblBank

 

 
Then if you are not able to view data and get bleow screen

 

http://localhost:3120/RajatAdoNetService.svc/tblProduct

 feederror

Then go to Internet explore option Tools –> Internet options –> Content tab ‘s Feed setting option and uncheck all the checkbox then

Refresh you will get fllowing screen

bankdata

Step 6:-

Simillarly you can access any entity in entity model or we can say any table from url.

 

Suppose I want to access product table then I have to write

 

 

 

I this way we can get table with data in xml format as shown above.

 

 

http://localhost:3120/RajatAdoNetService.svc/tblBank(36)

Where 36 is identity column value.

 

http://localhost:3120/RajatAdoNetService.svc/tblBank(36)/strBank

 

Step 8: if you want to access particular id’s column field’s value then you have to write column name also in url suppose I want tblbank’s strbankCode column value where id = 36 then I have to write below url 
As shown below

 

 

bankidparticulardata

 

I know this is not enough for your hunger even my too so don’t worry i will come up with more suitable example and live demo soon  here I hope you people got basic understanding. I will come up with latest example and more description in next chapters

Till then enjoy the code.

Keep Shining & Keep  Pushing  , Keep programming

Thanks

Rajat Jaiswal

 

 

Step 7:- if you want to access particular id data then you have to write following url