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>
Roman Pelepei gives smart answers on questions about C# .Net, ASP .Net, WPF and Silverlight programming with examples and source code.
вторник, 30 марта 2010 г.
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)
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>
<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.
Introduction
- Facebook Marketplace allows users to fill out listings in a similar format to the site's own status updates. For example, a sales listing would show up in your friends' news feeds as "Jerry is selling a lawnmower." You can opt to buy from any Facebook member or, if you prefer, only from your friends. This guide will give you all the steps necessary to start using the application.
- Step 1: Go to Facebook.com
- The easiest way to access Facebook is to enter its specific URL: www.facebook.com. You can also find it by entering "facebook" into a search engine and clicking on the first link.
Step 2: Enter Your Login Information
- The front page of Facebook.com has a dark blue bar at the top of the screen. On the right side of the bar are two dialog boxes. On the left dialog box, type in the e-mail address that you used to sign up for the account. On the left, enter the password that you created when creating your membership, then click the "Login" button.
- Step 3: Open the Marketplace Application
- Once you have logged in, you will find a "Marketplace" icon at the bottom left side of the screen, placed between the "Superlatives" and "Events" icons. Click on it and you will be directed to the Marketplace Home Page.
Step 4: Post a Listing
- At the top of the Facebook Marketplace page is a dialog box that looks similar to the "Status" box on your Home Page. The dialog box gives you four options:
- Sell It
- Sell for a Cause
- Give It Away
- Ask for It
- Click on the option that best suits your needs, then enter your request in the dialog box. For example, under "Ask for It," you could write "is looking for tickets to the Jimmy Buffett concert." Your request will automatically post to the site as "(Your Name) is looking for tickets to the Jimmy Buffett concert."
- If you want to sell an item on the Marketplace, fill out the dialog box with a brief description of the item for sale and click "Post." From there, you have the option of explaining why you are selling the item, the price of the item, a detailed description and, if you like, a picture.
- After you click "Submit," his posting will be visible to anyone who visits the Marketplace, along with the time and date of the posting. Potential buyers can either click on your name or the name of the item for sale to get more information.
- You will follow the same general process whether you're selling for profit, selling for a cause, (in which case you donate the proceeds to charity) or giving an item away for free.
Step 5: Find a Listing
- Underneath the dialog box, you will find a link for Location Settings. This will allow you to search for items in your home city, another city, throughout the United States or in the country of your choice. Using the links on the left side of the page, you can further refine your search to listings by your friends or listings that are only accompanied by photos.
- Step 6: Complete the Transaction
- Unlike most items on eBay, Facebook Marketplace items don't have a PayPal application available to complete a sale. The site simply recommends that the buyer and seller contact each other directly after the transaction to complete payment.
понедельник, 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]
Подписаться на:
Сообщения (Atom)