вторник, 30 марта 2010 г.

How to create AJAX AdRotator simple example

First Create a XML as App_Data/Advertisements.xml


<?xmlversion="1.0"encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~/images/dnc.jpg</ImageUrl>
<NavigateUrl>http://www.dotnetcurry.com</NavigateUrl>
<AlternateText>DotNetCurry Home Page</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/ssc.jpg</ImageUrl>
<NavigateUrl>http://www.sqlservercurry.com</NavigateUrl>
<AlternateText>SQL Server Curry Home Page</AlternateText>
<Impressions>20</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/writeforus.jpg</ImageUrl>
<Width>300</Width>
<Height>50</Height>
<NavigateUrl>http://www.dotnetcurry.com/writeforus.aspx</NavigateUrl>
<AlternateText>dotnetcurry.com Write For Us</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
</Advertisements>


Code your ASPX as below
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Timer ID="Timer1" Interval="2000" runat="server" />

<asp:UpdatePanel ID="up1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:AdRotator
id="AdRotator1"
AdvertisementFile="~/App_Data/Advertisements.xml"
KeywordFilter="small"
Runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>

Common SELECT Statements (SQL Server)



Followings are some examples of using SELECT statement. My table name tblTest. Followings are columns. (TestID, TestName, TestDate, TestCity )


1) Select * from tblTest (Returns all columns/Rows)

2) Select * from tblTest Where TestID=2 (Returns the row/s which TestID has value 2)

3) Select * from tblTest where TestID Between 10 and 20 (Return all rows between 10 and 20, this result includes 10 and 20)

4) Select * from tblTest Where TestCity in ('New York','Washington','California') (Returns all rows which city is NewYork, Washington, california)

5) Select * from tblTest Where TestName Like 'A%' (Return all rows where the name starts letter A)

6) Select * from tblTest Where TestName Like '%A' (Return all rows where the name ends letter A)

7) Select * from tblTest Where TestName Like '[ABC]%' (Return all rows of name start with A / B / C)

8) Select * from tblTest Where TestName Like '[^ABC]%' (Return all rows of name not start with A and B and C)

9) Select (TestName+space(1)+TestCity) as Address from tblTest (Returns single column address, name and city added together with a space)

10) Select * from tblTest Where TestName IS NULL (Return all rows which TestNane has null values)

11) Select * from tblTest Where TestName IS NOT NULL (Return all rows which TestNane has not null values)

12) Select * from tblTest Order By TestID Desc (Sort the result set descending order, Asc or not using any sort Ascending order)

13) Select 'Visual Studio' as IDE, '2010' as Version (Creating memory resident result set with two columns[IDE and Version])

14) Select Distinct TestID from tblTest (Returns unique rows based on TestID)

15) Select Top 10 * from tblTest  (Return 10 customers randomly)

16) Select getdate() (Shows the current date)

17) Select db_name() (shows the database name which you are working on)

18) Select @@Servername (Shows name of the server)

19) Select serverproperty ('Edition') (You can pass following ServerName, Edition, EngineEdition, ProductLevel to get current information about the server)

20) Select user_name (Get current user)
21)  Select *  into #test from tblTest  (Create temporary table #test and insert all records from tblTest)
22)  Select Max(TestID) from tblTest (Returns Maximum TestID from tblTest)
23)  Select * from tblTest Compute Max(TestID) (Returns two result sets - getting all rows and maximum value of TestID)

What the difference between div and span tag

The basic difference between them is ,div is block level element and span is inline level element.
<span> and <div> tags both allow a Web designer to style text and add other formatting attributes to their Web page. They are not interchangeable tags, though. <div> tags are block-level elements, whereas <span> tags are not.


Div
<div> tags are block elements that allow you to position elements contained within them


Example

<div style="color:#00FF00">
<h3>Welcome to Studentacad.com</h3>
<p>This is a paragraph.</p>
</div>


Span

<span> tags are NOT block elements

<p>This Blog is manage By<span class="blue">Aamir Hasan</span> (CEO)</p>

How to Use Facebook Marketplace



Facebook is the most popular social networking website, with over 200 million active users. Thanks to a partnership with the e-commerce service Oodle, Facebook has upgraded its Marketplace to compete with online marketplaces like Craig's List and eBay. This guide will show you how to use Facebook Marketplace to buy and sell items.

понедельник, 29 марта 2010 г.

Example of simple and effective method for generation of a random password VB .Net



Public Function GeneratePassword(ByVal PwdLength As Integer) As String
    Dim _allowedChars As String = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"
    Dim rndNum As New Random()
    Dim chars(PwdLength - 1) As Char
    Dim strLength As Integer = _allowedChars.Length
    For i As Integer = 0 To PwdLength - 1
        chars(i) = _allowedChars.Chars(CInt(Fix((_allowedChars.Length) * rndNum.NextDouble())))
    Next i
    Return New String(chars)
End Function


Smart Tips About Visual Studio 2010 Intellisense



Everybody loves visual studio 2008 Intellisense.  One side affect is that when Intellisense window is opened you can't see code beneath it.  But sometimes you need to see the code so you might be pressing ESC button to close Intellisense window.  You might not know that but there is a solution for that.


Press CTRL key while Intellisense window is open it will make your Intellisen window transpart so that you can view the source code beneath it.  Isn't it nice?

Some Useful Shortcuts for Coders in Visual Studio 2010



Followings are some useful shortcuts for coders.


Copy a single line - CTRL+C [Move the insertion point at the begin or end and press space bar, then press the shortcut key combination]
 Cut a single line - CTRL+X [Move the insertion point at the begin or end and press space bar, then press the shortcut key combination]
Comment a line - CTRL+K, CTRL+C [Keep the insertion point any where on line and press ]
UnComment a line - CTRL+K, CTRL+U [Keep the insertion point any where on line and press ]
Put/Remove a break point - F9
Remove all break points as once - CTRL+SHFT+F9 
Expand/Collapse a region- CTRL+M, CTRL+M
Intellisense - Ctrl+Space  [Press CTRL again make the drop down transparent]