Skip to main content

Posts

Showing posts from 2011

Co-related Subqueries in RDBMS

Subquery is a query within a query i.e. the inner query runs one time and its result is used by the outer query. For e.g. Select Ename from emp where city = (Select city from CityMaster where cityid=102) In the above query the inner query runs only one and its result is used by the outer query. But sometimes developers encounter a situation such as: To find out all the employees who are getting salary greater than the average salary of their own departments. Now in this kind of query, for every outer query the inner query will calculate the average salary of the department and then it is compared with the outer query. So it means the inner query fires for every row in the outer query unlike the normal sub query. This is called as "Co-related SubQuery". The actual query will be: Select x.ename, x.salary, x.deptno from emp x where x.Salary  > (    Select avg(salary) from emp where deptno=x.deptno )

SQL Server Reporting Services Scale out Configuration

One of the major benefits that SQL Server provides is the scaling out the SQL Server Reporting Services. SQL Server Reporting Services are used as concept of hosting reports which various business processes requires. SQL Server Reporting Services does an efficient job in hosting all the reports. But the problem comes when the load starts increasing in terms of number of users accessing the reports. This may result in: 1.        Slow processing of SQL Server Reports 2.        Crashing of SQL Server Reports Server In order to overcome the above issue, SQL Server Reporting Services can be overcome through the concept of scalability. This is implemented with the help of network load balancing (NLB) and Domain Implementation. The following figure gives a clear cut picture of how to achieve the same: I n the above example, there are there servers in the NLB serving the clients through a Virtual NLB IP i.e. 192.168.1.25. The client only knows the Virtual IP, h

Dynamic SQL Statements in SQL Server

Sometimes we need flexibility of using dynamic database name(s) in PL/SQL Statements. We might have an application where the database(s) are given an option in the drop downbox and the user can select any one. Based on the selection, another drop downbox shows all the tables in that database. In order to achieve the same, dynamic execution of sql statements can be used in SQL Server: declare @vDatabasename varchar (5 0 )          set @vDatabasename = 'Example' EXEC ( 'Select * from [' + @vDatabasename + '].sys.Tables' )

Delegates in VB.NET

Delegates in .NET Framework are equivalent to Function pointers in C and C++ language. Delegates helps in multithreaded application where one thread is accessing a UI element created by another thread. For e.g. the follwoing code will always return an error of type " Cross-thread operation not valid: Control 'TextBox1' accessed from a thread other than the thread it was created on." Imports System.Threading Imports System.Reflection Public Class Form1     Private trd As Thread     Private Sub Button1_Click( ByVal sender As System. Object , ByVal e As System. EventArgs ) Handles Button1.Click         trd = New Thread ( AddressOf DoTask)         trd.IsBackground = True         trd.Start()     End Sub     Private Sub DoTask()         Dim i As Integer         i = 1         While i <= 1000             System. Console .WriteLine( "the value of i is:" + i.ToString())             i = i + 1             Thread .Sleep(1000)

Metro inspired User interace used by Microsoft in HTML 5.

Microsoft is embedding the tile based user interface not in only in XBOX or next gen Windows, rather it is being tested on the web also. The screenshot given below shows how exactly it looks like: If somebody wants to see the action for himself/herself, please follow the link below and give me your valuable opinion: http://www.microsoft.com/windows/windowslive/whatsyourinboxlike/ Hope this tile based interface brings uniformity in all the Microsoft products.

Comma Separated Values with XML in SQL Server

There are situations when we want the data to be presented in the comma separated values rather than individual rows. For e.g. see the data in the pic given below: The above shows all Enames with its deptno. But the employees for each deptno is represented as an individual row. Now if we want to display the same data with comma separated values given in the screenshot below: In order to achieve this, we can use the XML Path function in SQL Server. This will help in generating the individual values and we can separate individual values with the help of comma or any other identifier. The query to generate the above resultset is: In the above query we have used substring function so as to remove the "," which comes at the start of every name. The above is a wonderful tool to rearrange the values in the form of comma separated values.

Windows 8 Tablet interface shown.

Microsoft has previewed the Windows 8 Tablet interface that will be used in the small form factors pcs/notebooks etc. and will run on ARM and other low energy chips. Microsoft has completely redesigned a new look for the tablet form factors that is a paradigm shift from other versions of Windows. The interface is inspired from the Windows Phone 7 Metro UI.  Windows 8 will also support the classic interface for running legacy applications. View Windows 8 Tablet interface

Common Table Expressions in SQL Server - CTE

A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query. In simple layman's terms, CTE basically provides data at the runtime which may come from multiple tables.  For e.g. if we have different tables like emp, dept, salgrade etc. then CTE can help in getting the resultset/dataset from multiple tables and form a temporary table. Then we can refer this table within other query any number of times.  For e.g. if we want to display the following: Deptno Dname Location TotalCount 10 Hotel Management Amritsar 6 20 Information Technology Chicago 1 30 Finance Ludhiana

Back again...

Well didnt post for a few days because of my movement to IIT Guwahati and Kharagpur for official campus drive. It was quite satisfying experience..... Will be posting few articles on SQL Server in the coming days... Stay tuned...

Some Pics for jQuery Session at Microsoft DreamSpark Yatra held on 23rd April, 2011

Some pics for the session on jQuery at Microsoft DreamSpark Yatra 2011 in Lovely Professional University.

Session on jQuery at Microsoft DreamSpark Yatra 2011

Today i.e. 23rd April, 2011, I delivered a session on jQuery at Microsoft DreamSpark Yatra 2011 in Lovely Professional University. That's was my first ever session in a Microsoft Event. Went well. It was a satisfying experience. Hope so, I was able to present the concept in a very easy manner and the audience was happy about it. Will look out more events to present new concepts and technologies...

Program Coding for Windows Based Chat Program in C# using Multithreading and Socket Programming

This is for all the students of C#.NET Batch under Lovely Skill Development Centre which run from 23rd Feb to 18th April, 2011. I have created a doc which contains the code for : a. Server Socket b. Client Socket c. ClientHandler Download the code from the following link https://onedrive.live.com/redir?resid=760AB0F61623B72!463&authkey=!AB5s3WQdbfcVxis&ithint=file%2cdocx

How to check the status of CAPS / NUMLOCK status in C#.NET

There are two types of codes available in C#.NET for checking the status of CAPS Lock and NUM Lock. a. Unmanaged Code : The code written in conventional languages like C, C++, VC++ etc. This kind of code can be called in the Managed Environment like .NET, JRE etc. [ DllImport ( "user32.dll" , CharSet = CharSet .Auto, ExactSpelling = true , CallingConvention = CallingConvention .Winapi)] public static extern short GetKeyState( int keyCode); bool CapsLock = ((( ushort )GetKeyState(0x14)) & 0xffff) != 0; bool NumLock = ((( ushort )GetKeyState(0x90)) & 0xffff) != 0; bool ScrollLock = ((( ushort )GetKeyState(0x91)) & 0xffff) != 0; MessageBox .Show( "Caps Lock is on: " + CapsLock.ToString()); MessageBox .Show( "Num Lock is on: " + NumLock.ToString()); MessageBox .Show( "Scroll Lock is on: " + ScrollLock.ToString()); b. Managed Code: Code which is managed by the Runtime environment. This type of code is basically a wr

Windows Internet Explorer 9 RTM

Microsoft RTM'd the Windows Internet Explorer 9 finally. This version of IE has changed the overall scenario of the IE again. With strong support from the end users, this IE is finally going to take Microsoft's IE into the right direction. Highly recommended. Sorry to the XP user's, the download is not available. Only meant for VISTA or Windows 7.

Happy moment..

For all my friends,colleagues and students that I have been "S elected as a peer reviewer for the International Conference “IEEE 2011 3rd International Conference on Machine Learning and Computing (ICMLC 2011)” to be held at Singapore from 26th-28th Feb, 2011"