This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package myPackage; | |
import myPackage.FastReader | |
{ | |
BufferedReader br; | |
StringTokenizer tokenizer; | |
public FastReader(InputStream stream) | |
{ | |
br = new BufferedReader(new InputStreamReader(stream)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
class Node | |
{ | |
int state;//current state of clocks | |
byte[] moves;//past moves done | |
public Node(int state, byte[] oldMoves, Byte lastMove) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// sets the paging control's properties | |
/// </summary> | |
protected void FormatPagingControl() | |
{ | |
//number of page links | |
int n = 4; | |
int lastpage = ((RowCount -1) / itemsPerPage) + 1; | |
int startPage = CurrentPage; | |
int lastPageToDisplay = Math.Min(lastpage, startPage + (n-1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void LoadItemsBasedOnCurrentPage() | |
{ | |
int take = CurrentPage * itemsPerPage; | |
int skip = CurrentPage == 1 ? 0 : take - itemsPerPage; | |
LoadData(take, skip); | |
} | |
protected void prev_Click(object sender, EventArgs e) | |
{ | |
LinkButton lnk = sender as LinkButton; | |
CurrentPage--; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void LoadData(int take, int pageSize) | |
{ | |
//somehow return all the objects you need. could be a datatable instead of a list of objects | |
List articles = GetAllItems(); | |
//set total item count | |
RowCount = articles.Count; | |
var topDocs = (from c in articles select c).Skip(pageSize).Take(take); | |
PagedDataSource pagedSrc = new PagedDataSource(); | |
pagedSrc.DataSource = topDocs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Page_Load(object sender, EventArgs e) | |
{ | |
if (!Page.IsPostBack) | |
LoadData(itemsPerPage, 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int itemsPerPage = 2; | |
private CurrentProperties _CurrentProps = new CurrentProperties(); | |
[Serializable()] | |
private struct CurrentProperties | |
{ | |
public int RowCount; | |
public int CurrentPage; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<tr><td> | |
<asp:PlaceHolder ID="plcPaging" runat="server" > | |
<asp:LinkButton ID="prevLnk" Text = "Prev" runat="server" OnClick="prev_Click"/> | |
<asp:Label ID="prevspacer" Text = " " runat="server" /> | |
<asp:LinkButton ID="lnkPage1" Text = "1" runat="server" OnClick="lnk_Click"/> | |
<asp:Label ID="spacer1" Text = " | " runat="server" /> | |
<asp:LinkButton ID="lnkPage2" Text = "2" runat="server" OnClick="lnk_Click"/> | |
<asp:Label ID="spacer2" Text = " | " runat="server" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<asp:Repeater ID="Repeater1" runat="server"> | |
<HeaderTemplate> | |
<ul id="navi"> | |
</HeaderTemplate> | |
<ItemTemplate> | |
<li> | |
<a href='<%#DataBinder.Eval(Container.DataItem, "ArticleURL")%>'> | |
<%#DataBinder.Eval(Container.DataItem, "Name")%> | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @dynamicSql = 'exec ' + @proc + ' ''' + @Actor1 + ''', '''+@Actor + '''' | |
EXECUTE sp_ExecuteSQL @dynamicSql |
NewerOlder