Tuesday 28 January 2014

selection sorting

 SELECTION SORT IN C++


Searching and sorting are popular in elementry data structures. Although now a days many advanced sorting techniques are used to sort a set of data, the basic sorting methods are still popular and are the used frequently.

The algorithm works is selection sort works by finding the smallest element in the list and by assuming that we are doing sorting in ascending order we replace that smallest found element with first element of list in this way we put the smallest element of list at first  position . Then we go on repeating this task for rest of elements. We then find the second smallest element in the list and then replace it with second element of list and thus we have our first two elements of list in sorted order of ascending order .


 I have given  C++ code for selection sort . The algorithm for selection sort is quite simple. In the first iteration, 1st element is compared against all the other elements (from array index 1 to array index n). In the second iteration 2nd element is compared with the elements from array index 2 to n. This process is repeated n-1 times.

 Disadvantages of Selection Sort
  • It is slow as the sorting process is too long and time consuming so it is mainly used for sorting when N (number of elements is less)


 Advantages of Selection Sort


  • Selection sort is easy to implement and does not require additional storage
  • It implements better on small lists




Code For Selection Sort
//It is for 10 elements and to change number of elements change 10 arguement in smallest function call


#include<iostream.h>
#include<conio.h>

int small , a1=0 , loc;
int a[ 10 ];
int main( )
{
int n, temp, temp1, count, compare;
int smallest( int , int ) ;
clrscr( );
cout<<"enter number of elements you want to sort";
cin>>n;
count=n-1;
for(int i=0; i<=n-1; i++)
{
cout<<"ARRAY ["<<i<<"] :- ";
cin>>a[ i ];
}
for(int j1=0;j1<=n-1;j1++)
{
compare = smallest(10,a1);            // call smallest() function to calculate smallest element
temp1 = a[ j1 ];
a[ j1 ] = a[ loc ];
a[ loc ] = temp1;
a1 = a1 + 1;
}
cout<<endl;
cout<<" sorted array is ";cout<<endl;

for(i=0;i<=n-1;i++)                                      // Print sorted Array 
{
cout<<"ARRAY ["<<i<<"] :- ";
cout<<a[i];cout<<endl;
}
 getch();
}
int smallest(int n,int a1)      // function to calculate smaller number
{
for(int k=a1;k<=a1;k++)
{
small=a[k];                       // smaller is assigned first element
for(int j=k+1;j<=n-1;j++)
{
if(small>a[j])                       // if value smaller than small variable found
                                             then small = a[j] 

{                                                      
small = a[j];
loc = j;                                 // and location of smallest loc = j
}
}
}
return(loc);                              //return location of smallest element
     }



Sunday 26 January 2014

Error dnndev/desktopmodules/ could not be found

http://geeksprogrammings.blogspot.com/2014/01/donetnuke.html
geeksprogrammings.blogspot.in

 DotNetNuke is one of best Web Content Management System Based on Microsoft .Net. The main ease is it's community Edition is OpenSource. After successfull installation of DotnetNuke if you want to develop your own modules for Dotnetnuke .you require following things

1. Microsoft Visual Studio
Download Visual Studio 2010

2. Microsoft Sql Server
Download SqlServer 2008 32/64 Bit

3 DotNetNuke C# Compiled Module  OR DotNetNuke Vb# Compiled Module
DotNetNuke C# / Vb Compiled Module For vs 2010

First I will recommend if you are using only one website of dotnetnuke at one time one one Host or computer . Put all your website files in C:\inetpub\wwwroot that will be ease not put it in folder in wwwroot as it also works in folder but there could be easy url if you keep them in wwwroot


Configure Host File

1. Press windowskey +r from keyboard
2. In Run dialog Box typein "c:\WINDOWS\system32\drivers\etc" and Hit Enter
3. Now in New window opened right click on hosts file and open it in your favourite notepad editor
4. Now put the following line in it and it looks something like in image below
Put this line :-
127.0.0.1       dnndev
5. Save this file and close it
http://geeksprogrammings.blogspot.com/2014/01/donetnuke.html
geeksprogrammings.blogspot.in

                      e.g. Hosts file

6. Now check it its done properly
7. To check it open any browser Typein- "dnndev/" and Hit enter
8. if your dotnetnuke site opens then host file configuration done.


Installation of C# Compiled Module Development 

1. Download DotNetNuke C# Compiled Module  OR DotNetNuke Vb# Compiled Module
DotNetNuke C# / Vb Compiled Module For vs 2010

2. Installing the Visual Studio Template is very straight forward.
3. First close all instances of VS2008  
4. Now copy the ZIP file that you downloaded from Codeplex in previous step
5. Now  paste this ZIP file into a very specific folder.
6. Open the following folder "My Documents\Visual Studio 2008\Templates folder". 
7. Within that folder go into ProjectTemplates\Visual C#\
8. within the Visual C# folder  simply create a new folder Web folder
9. Place zip file in web folder
10.  Now open  visual studio 2010 and click on file -> New Project 
11. christoc.com C# compiled module template give filename and click ok

ERROR

The Web Application Project hello is configured to use IIS. The Web server "http://dnndev/desktopmodules/hello/' could not be found."


Solution

Now we will do configuration for module development. check Which Version of IIS you are using .Follow the steps below to know which version of IIs you are using

Steps To Know IIS Version

1. Press windowskey +r from keyboard
2. In Run dialog Box typein "inetmgr" and Hit Enter
3. Now click on Help menu item in Menu Bar
4. click on About Internet Information Services
5. This gives version of IIs you are using like in image below
http://geeksprogrammings.blogspot.com/2014/01/donetnuke.html
geeksprogrammings.blogspot.in



6. Now depending on version using steps below


Configure Bindings In IIS 5

1. Press windowskey +r from keyboard
2. In Run dialog Box typein "inetmgr" and Hit Enter
3. This opens Internet Information Services
4. Right click on Default WebS ite
5. click on Properties. This opens Default Website Properties

http://geeksprogrammings.blogspot.com/2014/01/donetnuke.html

6. Focus on Web Site Tab under Web Site Identification Section
7. In this section you see Advance Button after Ip Address Label
8. click on Advanced Button
9. It opens Advanced Multiple Web Site configuration window
11. 10. Now click on Add button under Multiple identities for this Web site
http://geeksprogrammings.blogspot.com/2014/01/donetnuke.html
geeksprogrammings.blogspot.in


12. Put Ip Address field equals to All Unassigned
13. Put TCP Port equals to 80
14. Put Host Header Name equals to dnndev
15. click ok ....again click ok on other window
16. At last click apply and ok to close properties window


Configure Bindings In IIS 7

1. Press windowskey +r from keyboard
2. In Run dialog Box typein "inetmgr" and Hit Enter
3. This opens Internet Information Services
4. In the Connections pane, expand the server name, expand Sites, and then click the Web site on which you want to configure the bindings.
5. In the Actions pane, click Bindings
6. In the Site Bindings dialog box, click Add.
7. In the Add Site Binding dialog box, add the binding information
to solve dotnetnuke error add binding to iis
geeksprogrammings.blogspot.in


8.Put Ip Address field equals to All Unassigned
9. Put Host Header Name equals to dnndev
10 click ok

For any more problem or for Configure Bindings In IIS 7 or other problem you can comment here i am here to help you anytime