Wednesday, December 16, 2009

Operating Systems

Assume tht a MM with only 4 pages ,each of 16 bytes,is initially empty.the cpu generates the following sequence of virtual addresses & uses the lru replacement policy.
0 ,4,8,20,24,36,44,12,68,72,80,28,32,88,92
How many page faults?Wht r the page no of the pages pages present in the MM at the end of the sequence.
plz anybody solve this.

solution:- 7 page faults with 1,2,4,5 at the end.......
each page size is 16 bytes..so, these virtual addresses are divided by 16 and so we get as 0 0 0 1 1 2 2 0 4 4 5 5 1 2 5 5 ............. with lru replacement statergy, we will get as 7 page faults.... with 2,5,1,4 at the end.......

Go Back N Protocol

Sorry i have posted that picture in rapidshare which i guess is not working regarding that go back n protocol

here is the situation

Monday, December 14, 2009

Question Number 18 Gate 2009

#include
int fun(int n,int *fp)
{
int t,f;
if(n<=1)
{
*fp=1;
return 1;
}
t=fun(n-1,fp);
f=t+*fp;
*fp=t;
return f;
}
int main()
{
int x=15;
printf("%d", fun(5,&x));
return 0;
}

i hope these pictures give a clear idea of the question




Tuesday, December 8, 2009

question in orkut community.....!!!!!

Assume tht a MM with only 4 pages ,each of 16 bytes,is initially empty.the cpu generates the following sequence of virtual addresses & uses the lru replacement policy.
0 ,4,8,20,24,36,44,12,68,72,80,28,32,88,92
How many page faults?Wht r the page no of the pages pages present in the MM at the end of the sequence.


solution:

Consider this figure....
Till the first 4 page requests come total page faults are 4....



Now consider that main memory is full with 4 pages...now any new page request makes the replacement policy...so we have to go for replacement algorithms...since here we use lru..the least used page would be replaced....since page 20 is been used very recently...than page 8 than page 4 than page 0...therefore page 0 is replaced with page 24 which is 5th page fault....hence till now the observation is

initial 5 unique numbers so number of page faults are 5 and last 4 pages are placed in the memory...

consider this figure...just showed page fault of page 24 then page 36 and then showed final page memory contents



so totally
page faults: 15
final contents of the memory 28 32 88 92

Tuesday, July 21, 2009

Google Customised Search

There are generally two types of searches....
1..within the website
2..outside the website(internet)
the search within the website is called as the custom search(google providing some features to embed into particular website)
In this application i ll explain the procedure to use google custom search in a particular website.....

step 1:
http://www.google.com/coop/cse/
and login with your credentials of gmail....
step2:
go through the steps which the google does and fill in details step by step and the figure looks something similar to this....



once you done with the general information it will lead to figure below....
which will have all the custom search engines which you created....



just go through the control panel of the search engine u need to develop and fill in the details of it....the basic section of your search engine would be something similar to this....



try to keep as many keywords for the search engines as possible so that it would be easy to find the contents of your website using those keywords....change the options as per the requirement...i hope you ll do every thing i am just trying to help only by using suitable figures....here comes the next figure...



next comes indexing section this is the main important thing of the process..here you need to add the urls of your website in which you need to search..basically when the ultimate search engine comes then it checks your request only in these urls...hence one must be very careful in giving these urls....



once the urls been placed then check these urls in sites section of the homepage....here you ll be shown some urls where in it vl give the urls of the sites you entered in the previous section....



when you complete this section you ll have to copy the code which will be under code section...this code must be copied to all the pages where you want to insert the search box of custom search....the preview of it would be like this.....



this completes everything of the procedure of the custom search...now its left to google to implement it and you just need to wait for few hrs to get your custom search to be implemented in the website.....
once the google implements it then it would be clearly visible in the indexes section....where how many urls hav been indexed would be visible if the google implements everything then the number of links u placed would be indexed and it would be fully indexed..by default it is partially indexed....



once completed done...you can preview it in the preview section....and enjoy the feature to be implemented in your website.....



here by default it gives free custom search...for free custom search google provides some adds to be placed on top of the links....hence if you need them not to be placed in this section then purchase with respective amount....and enjoy the custom search to the fullest......

thanx
regards
kiran.joshi

Monday, July 20, 2009

MSI deployment

The following procedure i ll deal with the deployment of msi(microsoft installer)......
i would like to explain this procedure with the help of figures so that every one who view this procedure would understand very easily....

Basically an msi is a microsoft installer...with the help of this any website which a user will create in his pc would install completely in someother target machine...just similar to software(which installs many files in program files)

My intention in this blog is to create an msi which will install my two applications in the target machine...(I am using visual studio 2005)
------------------------------------------------------------------------------------


This figure is the first step in deploying an msi for the project...in this there are two options
1..windows application
2..web application
suitable application you need to create for urself...window application is similar to a normal software which can be configurable and can be installed anywhere in the system...where as web application needs an IIS to be installed in the target machine...select the application suitable to your need.....



once you select the type of setup you need it will have the window shown in the figure..here there are three important sections
1..folders to be visible on the target computer
2..contents inside the folders of the selected one in the 1st section
3..solution explorer which has every necessary thing to be used in the project.....



Here you need to add in the websites which you need to be installed in the target machine...there is no limit to the number of websites you add to the project...(i have added two websites in my project which can be viewed in the next figure) which can be done just by rightclicking the solution explorer->add->existing website....


This is just to show that more than one websites can be added to the project....


This section mainly focusses on the folders to be installed in the target machine once the application launches...my intent here is to have two applications to be launched after installation..hence i hav created the necessary folders in the filesystem view of the application....It is just by right clicking on the target machine and selecting the webfolder..which will create one webfolder in the filesystem section.....


Not just the normal webfolders you can create some special folders like users desktop, program files etc., so that the files present in these sections would be same as the files which are going to be installed in the target machines desktop and program files section.,(this can be achieved by right clicking on the "file system on target machine" adding some special folders which you can view it in the figure.....


coming to adding the contents in your application...(here i have created two folders seperately in the target machine to install my two websites in those two folders) now one just need to add the contents to the folder they needed...just select the folder and rightclick ->add->project output and this will pop up one window in which you will hav all the website contents you added in the third step (third figure) and select one particular website and add the contents to that folder....similar way add the contents to all the folders in your application...one can even create a shortcut so that it can be used directly to view the contents of the folder or any particular application which can be explained in the further figure....


i hav created a shortcut on the users desktop and mentioned its path to the selected folder....select the users desktop right click on it select "create a short cut on the desktop" and change the necessary properties of the shortcut like
defaulty the target would be the desktop itself...change it accordingly...
you can even change the icon of the shortcut but for that you need to add that icon to the project...once the application installs in the target machine it will generate a shortcut on the desktop....
one can change the appearence of the installation process with the customized pictures and customised messages which can be configurable in the view section of the project...can be shown in the figure below



different views are there for the application...and i wont deal with it detailly you can check that information from the necessary sources.....



the final step is to build the msi file..it is just a simple process just right click on the project and select build website....it will generate two files
.msi and .exe
both can be used to launch the application....
i hope every one understood the process of deploying a website....or else just send a mail to me i would modify this content based on your comments.....

thanx
regards
kiran.joshi

Monday, July 13, 2009

Sending data from one page to another page in asp.net using c#

Introduction

Passing parameters from one page to another is a very common task in Web development. Granted, its importance and frequency has faded a bit with ASP.NET's inherent preference for postback forms, but regardless, there are still many situations in which you need to pass data from one Web page to another. There are three widely used methods of passing values from one page to another in ASP.NET
Main
-------------------------------------------------------------------------------------
1. Using Query String
We usually pass value through query string of the page and then this value is pulled from Request object in another page.

FirstForm.aspx.cs

Response.Redirect("SecondForm.aspx?Parameter=" + TextBox1.Text);


SecondForm.aspx.cs

TextBox1.Text = Request. QueryString["Parameter"].ToString();


This is the most reliable way when you are passing integer kind of value or other short parameters.

More advance in this method if you are using any special characters in the value while passing it through query string, you must encode the value before passing it to next page. So our code snippet of will be something like this:

FirstForm.aspx.cs

Response.Redirect("SecondForm.aspx?Parameter=" + Server.UrlEncode(TextBox1.Text));


SecondForm.aspx.cs

TextBox1.Text = Server.UrlDecode(Request.QueryString["Parameter"].ToString());
-------------------------------------------------------------------------------------
2. Passing value through context object
Passing value through context object is another widely used method.

FirstForm.aspx.cs

TextBox1.Text = this.Context.Items["Parameter"].ToString();

SecondForm.aspx.cs

this.Context.Items["Parameter"] = TextBox1.Text;
Server.Transfer("SecondForm.aspx", true);


Note that we are navigating to another page using Server.Transfer instead of Response.Redirect.

Some of us also use Session object to pass values. In that method, value is store in Session object and then later pulled out from Session object in Second page.
------------------------------------------------------------------------------------
3. Posting form to another page instead of PostBack
Third method of passing value by posting page to another form. Here is the example of that:

FirstForm.aspx.cs

private void Page_Load(object sender, System.EventArgs e)
{
buttonSubmit.Attributes.Add("onclick", "return PostPage();");
}

And we create a javascript function to post the form.

SecondForm.aspx.cs

function PostPage()
{
document.Form1.action = "SecondForm.aspx";
document.Form1.method = "POST";
document.Form1.submit();
}
TextBox1.Text = Request.Form["TextBox1"].ToString();


Here we are posting the form to another page instead of itself. You might get viewstate invalid or error in second page using this method. To handle this error is to put EnableViewStateMac=false
-------------------------------------------------------------------------------------
4. Another method is by adding PostBackURL property of control for cross page post back

In ASP.NET 2.0, Microsoft has solved this problem by adding PostBackURL property of control for cross page post back. Implementation is a matter of setting one property of control and you are done.

FirstForm.aspx.cs



SecondForm.aspx.cs

TextBox1.Text = Request.Form["TextBox1"].ToString();

In above example, we are assigning PostBackUrl property of the button we can determine the page to which it will post instead of itself. In next page, we can access all controls of the previous page using Request object.

You can also use PreviousPage class to access controls of previous page instead of using classic Request object.

SecondForm.aspx

TextBox textBoxTemp = (TextBox) PreviousPage.FindControl("TextBox1");
TextBox1.Text = textBoxTemp.Text;

As you have noticed, this is also a simple and clean implementation of passing value between pages.
Conclusion

Passing values between pages is another common task accomplishes in web based development. As we have discussed many of mechanisms above, I prefer and recommend to use Query String then other methods for its clean and simple implementation as long as your parameter doesnt have security concern.
-------------------------------------------------------------------------------------

Here is the one of the procedure via visual web developer





This is the Default.aspx file...now i want to send the data (textbox information) to other page form.aspx....once the button is pressed then the data must go to form.aspx in order to access there....





This is Default.aspx.cs file...In this what actually i am doing is just simple...just storing the textbox1.text file into a string and redirecting to form.aspx page which is our requirement...and the syntax to send the data to other page is given at the top of this topic...hope u understood....





This is form.aspx page where the sent data from Default.aspx is being rendered....and the return value i.e., the data sent from Default.aspx will be stored into the textbox as soon as the page is loaded...the code to retrieve the data is shown in the next picture.....




Here is the code to retrieve the data from the previous form i.e.,Default.aspx...i hope the picture itself is self explanatory....

Thanks,
Regards Kiran Joshi
maqkiran@gmail.com

Monday, July 6, 2009

Master page

This is the important concept of .net as it is similar to inheritance concept in oops...y because basically inheritance is the reusability of the features on one thing in other..here in this concept we inherit properties of one file(masterpage) into other page(inherited page)....

Here i am going to provide with one of the example in which i ll tell the procedure to use the concept of master page in your visual studio projects...you can use either vs(visual studio) or even visual web developer....

you can go through this link to view the procedure of the master page
ClickHere to go to masterpage page

Basically the advantages of using this master page concept are....
-> code reusability
-> easily managable code(efficiently handled code)
-> makes complex things easier

i guess this information is enough to get an idea of master pages in dotnet.....
i hope you are happy with my content....

if any further improvements are necessary then mail it to me....or else please leave a comment...

regards,
kiran joshi

Saturday, July 4, 2009

Need of style sheets....

STYLESHEET:
for suppose..in your project of .net or any other project(vs) you have 8 aspx pages
and you need to have same font in all those pages, the basic thing which we do is that go to each and every page and set the font to your required font, undoubtedly this is a cumbersome task, so to overcome this situation we go for a concept called as style sheets in .net. In .net there is a special document called as stylesheet which enables you to inherit the properties in the style sheet to be embed in your required page...

for example...in the same project your requirement is to have same type of font in all the 8 aspx pages..so v just need to do one thing, set the font in the style sheet and give the link of the style sheet to your required pages, thats it your requirements has been met with ease and efficiency....the main advantage of this style sheet is that the settings are configurable efficiently change in one page reflects in all the pages which inherits it(style sheet).

Thursday, July 2, 2009

My 7 night out weeks

I am posting the links where i worked very recently as a part of pre boot camp in the company called as MAQ.....


Assignment1:

my old website
http://kiranmaq.6te.net/first/homepage.html
my new website
http://kiranmaq1.6te.net/home.html
and i redirected my webpage to the new one when old one is
clicked.....
____________________________________________________

Assignment2:
library management
http://apps.facebook.com/kiranlib
____________________________________________________
Assignment3:
vimeo link:
http://www.vimeo.com/4560570

youtube:
http://www.youtube.com/watch?v=PdQ9V9NE4mg
____________________________________________________
Assingment 4:
azure hosting
http://kiranmaq.cloudapp.net/default.aspx
____________________________________________________
Assignment 5:
birthday application
http://apps.facebook.com/bdaykiran
____________________________________________________
Assignment 6:
leavemanagement
http://apps.facebook.com/kiranmaq
____________________________________________________
Assignment 7:
mobile site
http://kiranmaq.param.mobi

Tuesday, June 30, 2009

Procedure for windows live id authentication

1--Initially u hav to create an application for ur website

go to this link and follow the procedure given there
http://msdn.microsoft.com/en-us/library/bb676626.aspx

domain name keep it empty
give a url where u want to redirect the page once signed in with windows live id
at the end of it u will get application id and secret key

2--then go to visual web developer and open a website
and paste this code

iframe style="BACKGROUND-COLOR: #666666"
id="I1"
name="I1"
marginheight="0"
src="http://login.live.com/controls/WebAuth.htm?appid="your application id here"&Context="your secret key here"&style=font-size%3A+10pt%3B+font-family%3A+verdana%3B+background%3A+white%3B" frameborder="0"
name="I1"
marginwidth="0"
scrolling="no"
align="middle"
marginheight="0"


Imp note:
the above code must be in < and />tags as i could not place those in this blog i am leaving that thing to you ppl to do by yourself

at the end i hope you know that thing....

Note:
make sure that u have changed the appid and secret key in that code.....
even this code can be placed in an html file and u ll get a signin button on viewing the html file where once u signed in it vl redirect it to the page u mentioned while creating your application......


i ll tell what i know about this procedure how it works

whenever you created the application it maintains in the database the following
1.your appid
2.your secret key
3.your return url

once signin button is pressed the appid and secret key are loaded from the signin button itself coz you pasted the appid and secret which u got during the creation of application. then the windows live id checks for the authentication, if the details are right then the appid and secret key both checked for redirecting it to the url which you mentioned. If appid and secret both dint match with any of the details in the database then it vl generate an error. if they are correct then it redirects it to the return url present in the application. If the url doesnt have any page then it generates error 404 mentioning that there is no page requested.......

About this blog

There is nothing great to be discussed about this blog. Actually i am bit selfish in maintaining this blog. Y coz i just want to keep the info about what i learnt in the local system but as i saw advantage in putting this information in internet via blogs websites etc., thought of maintaing one. But creating and maintaining a website is a hectic job....so few of my friends suggested me to use blogs as these are easily used...i am a bit new to these kind of things and even my language is not that much enough to maintain the blogs...as i said its a bit selfish thing and i would be more than happy if i find any person seeking help from this.