Friday, February 22, 2008

Little Animation on the web page!

I was googling something and suddenly i found this particular technical web site.. http://nishant.hopto.org/wordpress/

There is nothing much in the site but i found this interting though !

And found this Cool thing which we can add to a ASPX page, meta content part and check out the amazing way to ignore the postback.


Just paste the below TAG in your HTML, it will cause IE to use DirectX transformation to render your page. This gives a very cool and pleasing look.


""<"meta equiv="”Page-Exit”" content="”progid:DXImageTransform.Microsoft.Fade(duration=".5)”">""

The way I understand this works is that IE sends a request for the new page but does not clear the page you have on your screen right now. When IE has the second page ready in the buffer, it just uses DirectX to transform the image of the previous page into the image of the new page.

You can try these other effects too :

content=”progid:DXImageTransform.Microsoft.Wheel(duration=0.5,spokes=5)”
content=”progid:DXImageTransform.Microsoft.Barn(duration=0.5,orientation=horizontal)”
content=”progid:DXImageTransform.Microsoft.Blinds(duration=0.5,bands=5)”
content=”progid:DXImageTransform.Microsoft.CheckerBoard(duration=0.5)”
content=”progid:DXImageTransform.Microsoft.Fade(duration=0.5)”
content=”progid:DXImageTransform.Microsoft.GradientWipe(duration=0.5,wipeStyle=0)”
content=”progid:DXImageTransform.Microsoft.Iris(duration=0.5,irisStyle=STAR)”
content=”progid:DXImageTransform.Microsoft.Iris(duration=0.5,irisStyle=CIRCLE)”
content=”progid:DXImageTransform.Microsoft.Pixelate(duration=0.5,maxSquare=40)”
content=”progid:DXImageTransform.Microsoft.Wheel(duration=0.5,spokes=5)”
content=”progid:DXImageTransform.Microsoft.RandomDissolve(duration=0.5)”
content=”progid:DXImageTransform.Microsoft.Spiral(duration=0.5)”
content=”progid:DXImageTransform.Microsoft.Stretch(duration=0.5,stretchStyle=push)”
content=”progid:DXImageTransform.Microsoft.Strips(duration=0.5,motion=rightdown)”

Plus, you can apply these affects at various points in your site or web pages :

meta http-equiv=”Page-Enter”
meta http-equiv=”Page-Exit”
meta http-equiv=”Site-Enter”
meta http-equiv=”Site-Exit“

Clearing Session Variables

Session.Abandon and Session.Clear() is the two methods that gave me a HUGE headache for the day.

Logout isnt working as i wanted. Only after a postback, its clearing the controls.

What to do, I Donno.. If i get the solution, ill try to add it here.

This was the Code That i was using in the LOG OUT Page LOAD

Session.Abandon()
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Response.Cache.SetExpires(Now().AddSeconds(-1))
Response.Cache.SetNoStore()
Response.AddHeader("Pragma", "no-cache")

This also didnt help much. Later i Added this particular line in all the ASPX pages.

<%@ OutputCache Location = "none" %>

FINALLY IT WORKED. NOW ITS FINE, BUT STILL UNSURE, WHY IT WAS NOT WORKING.

THIS IS ONE OF THE SIMPLEST REASON, WHY WEB DEVELOPMENT IS "NOT SO EASY"

Saturday, February 9, 2008

Important Sql Server 2000 Queries !!

I'll try to add some important Sql Server Queries in the below post.
This will be handy for me some day.

Q1 : To select Column Names from a table:

SELECT column_name

FROM INFORMATION_SCHEMA.COLUMNS

WHERE table_name= 'YOUR TABLE NAME'

Modified Date of a DB object - Sql Server 2000

Some days Back i had a particular requirement like.. i wanted to identify the modified datetime of a Database object in Sql Server 2000.

We have the table called sysobjects in every database which is supposed to store all these information.

There are two columns which is of interest for the above scenario

1. crdate Created Date
2. refdate - ( This also stored the Created Date only )

After i saw refdate, i was really excited and thought that this was the column which stores the modified datetime of a Database object.
But my excitement came down even more quickly as it also stored the date of Creation of the object.

Thought Google Is God and started Googling.

After googling for some time, Guess what i discoverd, There is no way u can get the Modified datetime of a Database object in Sql Server 2000.


The day after, i was just googling around for the same.

I knew all Changes to the database are recorded in the log files, So if i was able to read / Query the Sql Log files, i was able to meet my requirement.

I tried to open the Sql Log in a notapad, after stopping the server, but there was nothing in a readable format.

I Googled Again....... ;( "How to read Sql Log files"

And i finally found some thing interesting, DBCC..

DBCC is an abbreviation for Database Console Command. DBCC commands are generally used to check the physical and logical consistency of a database, although they are also used for a variety of miscellaneous tasks that can be done.

These are not popular things which are known to everyone...

There is a command called dbcc log

whose signature looks like dbcc log(databasename/dbid, type)

Ex : DBCC log(temp,3)

I thought this will provide information which we cant digest...

The quest for my requirement continues....


For the time being....
Chao....


Happy Coding

----------------------------------------------------------------------------------------------------------------------------

Sql Server 2000 - Providing Permissions

Providing Permissions for a New database Login User.

Some days back, we had a new requirement, where in we need to create a separate database user to access the application.
This user must not be the DB owner.

So, we created the user in the Sql Server Enterprise Manager --> Security --> Logins --> New Login.

Now, we had provide the New Login name, and choose the type of authentication required for the user
A. Windows Authentication
B. Sql Server Authentication.


As per our requirement, we choose B, and provided the credentials.

The next step is to select the Database and the Language.

Now, Goto Database Access Tab and we need to CHECK the databases that this new user need to access.

After checking, we need to assign the roles for this user

db_datareader and db_datawriter will ensure this user to select or Insert into tables / views.

After this, we need to provide the execute permission for the Stored Procedures which need to done manually for each and every SP.

This is a tiresome process if we've more SP.

After Googling around, i found a script which will output a Script which if run, will provide the permissions for the user to execute SPs.



This script really came Handy !!

select 'Grant Execute on ' + name + ' to ' + 'SQLServerUSERName'
from sysobjects where xtype in ('P')


Just Change "SQLServerUSERName" to the New DB Login Name and Magic... The output of this script gives u a set of select statements which u need to execute and Thatz it, The permissions are provided for the user.




Happy Coding

----------------------------------------------------------------------------------------------------------------------------

Windows Authentication

We are working on an Intranet Application which has Windows Authentication.

Following piece of code, gets you the name of the user who has logged in.

---

Imports System.Globalization


Dim GetUser As String
Dim strUID() As String
Dim User As System.Security.Principal.IPrincipal
User = System.Web.HttpContext.Current.User
GetUser = User.Identity.Name
strUID = GetUser.Split("\")
GetUser = strUID(1)

---

Once we put this code, we should get the logged in User's Name in the GetUser var.

But, we are facing some problems in a few systems where this name is getting populated incorrectly.

Instead of the Logged in user's name, we are getting the server's login name.

Googling around to solve this problem, ,no luck yet.

Once i solve this, ill put the solution here.


Happy Coding

----------------------------------------------------------------------------------------------------------------------------