Get current logged in user on DB!

24
Feb/10
0

SELECT HOST_NAME() AS HostName, SUSER_NAME() LoggedInUser

thanks to http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/

SQLServer2005 Check for locks in DB

8
Feb/10
0

sp_lock result set contains one row for each lock held by the sessions specified in the @spid1 and @spid2 parameters. If neither @spid1 nor @spid2 is specified, the result set reports the locks for all sessions currently active in the instance of the Database Engine.

http://msdn.microsoft.com/en-us/library/ms187749.aspx

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault=”Deny”), or set explicitly by a location tag with overrideMode=”Deny” or the legacy allowOverride=”false”.

8
Feb/10
0

Cool Thread to work around the Handles Prob.
http://forums.asp.net/t/1220987.aspx

IIS Small checklist when installing with windows7

8
Feb/10
0

Configure Windows Authentication (IIS 7)
http://technet.microsoft.com/en-us/library/cc754628(WS.10).aspx

Debugging not allowed on IIS
http://forums.iis.net/p/1154366/1926220.aspx

Manage Handlers
http://technet.microsoft.com/en-us/library/cc754147(WS.10).aspx

ASP.NET Error: The server tag is not well formed

8
Feb/10
0

Good work around which i didnt know….damn it!!
Just use single quotes instead of double quotes.

http://blogs.clearscreen.com/ragc/archive/2004/10/28/525.aspx

SQL Server – Random numbers!

30
Oct/09
0

Howwwwwwwwdy geeks

I found this little SQL script from Pinal Dave’s blog http://blog.sqlauthority.com. It generates random numbers as the title says, pretty nifty :) I altered it abit since im working with real numbers but the types can be changed to anything you want as long as its numeral hehe

DECLARE @Random real
DECLARE @Upper real
DECLARE @Lower real

—- This will create a random number between 1 and 999
SET @Lower = 0.5 —- The lowest random number
SET @Upper = 4.5 —- The highest random number
SELECT @Random = ROUND(((@Upper – @Lower -1) * RAND() + @Lower), 2)
SELECT @Random

Enjoyyy

.NET Checkboxlist one item selection only

28
Oct/09
0

What’s up fellow geeksters of the world!

I found this nifty little solution just now regarding checkboxlist! :) Lets say you have a checkboxlist in your application but you want just one item to be selected, you would ask me, why not use radiobuttons? I have a very simple answer for that, “the programmer before me was a complete jack ass” but anyways :D here’s the code

If [checkboxlist].CheckedItems.Count = 1 Then
For i As Integer = 0 To CByte(Me.[checkboxlist].Items.Count – 1)
[checkboxlist].SetItemChecked(i, False)
Next
End If

According to what value you put in the if statement the check box list will allow check boxes to be selected. I’ve already did this countless times but sometimes i forget about it. It is a small solution but handy if you put it on-line and make a reference to it at a later stage ;)

Enjoyy dudes and dudettes!

Unable to start debugging on the web server. The server committed a protocol violation. Section=ResponseStatusLine Problem!

8
Oct/09
0

Howdy fellas. Sooooo i tried to run a project this morning at work, and i was working on a fresh pc. but when i was trying to run it it was givving me this error. Unable to start debugging on the web server. The server committed a protocol violation. Section=ResponseStatusLine

After an hour of “”"”melodic”"”"” words. I found out that skype was using port 80 as an alternate port of usage.!!!! so in order to get rid of such problem you need to tick that off…So open skype…go on tools > options > Advanced > connection and tick the “Use port 80 and 443 as alternatives for incoming connections” because it reserves it, it seems….ohhh welll

Parpparpraaaaaaaa an other case solved :P

Cya

Set HTML header items programmatically in ASP.NET 2.0

14
Aug/08
0

http://aspdotnetcodebook.blogspot.com/2008/03/set-html-header-items-programmatically.html

protected void Page_Load(object sender, EventArgs e)

{

AddMetaContentType();

AddMetaTag(”keywords”, “word1, word2, word3…”);

AddMetaTag(”description”, “bla bla bla”);

AddStyleSheet(”/includes/style.css”);

}

private void AddMetaContentType()

{

HtmlMeta meta = new HtmlMeta();

meta.HttpEquiv = “content-type”;

meta.Content = Response.ContentType + “; charset=” + Response.ContentEncoding.HeaderName;

Page.Header.Controls.Add(meta);

}

private void AddMetaTag(string name, string value)

{

HtmlMeta meta = new HtmlMeta();

meta.Name = name;

meta.Content = value;

Page.Header.Controls.Add(meta);

}

private void AddStyleSheet(string relativePath)

{

HtmlLink link = new HtmlLink();

link.Href = relativePath;

link.Attributes["type"] = “text/css”;

link.Attributes["rel"] = “stylesheet”;

Page.Header.Controls.Add(link);

}

Convert String to StreamReader

17
Jun/08
0

Dim MyMemoryStream As MemoryStream = New MemoryStream(System.Text.Encoding.UTF8.GetBytes(”String”)

Dim MyStreamReader As New StreamReader(MyMemoryStream)