5/22/2012

Tips writing jQuery function for beginner

Wirting jQuery 1: //---------------------------------------------- 2: //a shortcut code noConflict 3: (function($) { 4: // do something on document ready 5: })(jQuery);   7: //a long code 8: $(document).ready(function() { 9: // put all your jQuery goodness in here. 10: });   12: //a shortcut code 13: $(function() { 14: // do something on document ready 15: }); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode...

Save And Share :

5/19/2012

Get URL after Rewrite in C#

When you use the URL rewrite module in C# with mod_rewrite rules like  www.domain.com/products/clothes you can easy to get anything after www.domain.com by use below code HttpContext context = HttpContext.Current; string value = context.Request.RawUrl; and you can get it /products/clothes  .Using function Regex to Split that string string[] url = Regex.Split(value, Regex.Escape("/")); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode...

Save And Share :

5/18/2012

Sys.WebForms.PageRequestManagerParserErrorException

When I try use Ajax ScriptManager to update panel, I have a trouble with an error : Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. After just I Rebuild all project and no see last error but found another error: Uncaught Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch. now i don’t know how to fix it...

Save And Share :

5/15/2012

Paging in SQL Server 2005 (ROW_NUMBER() - Select dữ liệu trả về trong 1 khoảng)

Introduction Developers and database administrators have long debated methods for paging recordset results from Microsoft SQL Server, trying to balance ease of use with performance. The simplest methods were less efficient because they retrieved entire datasets from SQL Server before eliminating records which were not to be included, while the best-performing methods handled all paging on the server with more complex scripting. The ROW_NUMBER() function introduced in SQL Server 2005 provides an efficient way to limit results relatively easily. Paging Efficiency In order to scale well, most applications only work with a portion of the available...

Save And Share :

5/14/2012

Add Social Sharing Button to Blogger

1: <span class='post-share'> <p> 2:   3: Save And Share : 4:   5: <a expr:href='&quot;http://twitter.com/intent/tweet?text=&quot; + data:post.title + &quot;&amp;url=&quot; + data:post.url' target='_blank' title='Tweet This !'><img alt='Tweet This !' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCcBZqLbjK3fBwQnjANcDxKkSeNtPQ5aNpDrUn4X3PiiCQy4p_fE_wXPVexWGioTTipnNb60XXCZUoXLPFfdIqpR9j-TG8J-bsejM8nu_ImMnuRsI0xRweVbHnfsgbdAiFTaiiQ7wCsuY/'...

Save And Share :

Thuật toán sắp xếp mảng

using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Question1 { private int[] arrA; public string FindNumber(int n) { string result = ""; try { int i; int j; int tmp; arrA = new int[n]; for (i = 0; i < n; i++) { Console.Write("\n\tNhap vao phan tu thu " + (i + 1)+": "); arrA[i] = int.Parse(Console.ReadLine()); } for (i = 0; i < n - 1; i++) ...

Save And Share :

ASP.NET: Tạo bộ tìm kiếm gần đúng (tương đối) giống như tamtay.vn, google.com

Default.aspx <form id="form1" runat="server"> <div style="text-align: center"> <span style="color: #ff6600"><strong>TÌM KIẾM TƯƠNG ĐỐI</strong></span><br /> <span style="font-size: 10pt; font-family: Verdana"> Nhập từ cần tìm:</span> <asp:TextBox ID="TextBox1" runat="server" Width="421px"></asp:TextBox> <asp:Button ID="btnSeach" runat="server" Text="Seach" OnClick="btnSeach_Click" /><br /> <br /> <hr /> <asp:Label ID="lblSQL" Text="" runat="server"></asp:Label> </div> ...

Save And Share :

Convert chữ tiếng việt có dấu thành không dấu C#

Hàm dùng để convert chữ tiếng việt có dấu thành chữ tiếng việt không dấu. public static string ConvertVN(string chucodau) { const string FindText = "áàảãạâấầẩẫậăắằẳẵặđéèẻẽẹêếềểễệíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵÁÀẢÃẠÂẤẦẨẪẬĂẮẰẲẴẶĐÉÈẺẼẸÊẾỀỂỄỆÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴ"; const string ReplText = "aaaaaaaaaaaaaaaaadeeeeeeeeeeeiiiiiooooooooooooooooouuuuuuuuuuuyyyyyAAAAAAAAAAAAAAAAADEEEEEEEEEEEIIIIIOOOOOOOOOOOOOOOOOUUUUUUUUUUUYYYYY"; int index = -1; char[] arrChar = FindText.ToCharArray(); while ((index = chucodau.IndexOfAny(arrChar)) != -1) { int index2 = FindText.IndexOf(chucodau[index]); ...

Save And Share :

Demo using CollectionBase (Set - Get fields in Struct or Object)

using System; using System.Collections; using System.Windows.Forms; namespace WindowsApplication5 { public partial class Form1 : Form { Collection collection1 = new Collection(); Collection collection2 = new Collection(); public Form1() { InitializeComponent(); } private void TurnIn_Click_1(object sender, EventArgs e) { // them vao collection collection1.Add(int.Parse(txtAge.Text), txtName.Text); lblStatus.Text = "Test " + txtAge.Text + " added."; } private void LookAt_Click_1(object sender, EventArgs e) ...

Save And Share :

How to Post data in C# . NET HttpWebRequest

using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Net; namespace ConsoleApplication1 { class Class1 { public string Post(string url, string postData) { string vystup = null; try { //Our postvars byte[] buffer = Encoding.ASCII.GetBytes(postData); //Initialisation, we use localhost, change if appliable HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url); //Our method is post, otherwise the buffer (postvars) would be useless WebReq.Method...

Save And Share :

Index trong MS SQL SERVER

Nonclustered khác Clustered ở chỗ trong 1 table có lượng dữ liệu lớn với hàng ngàn, hàng triệu record thì khi tạo Clustered Index nó sẽ sắp xếp dữ liệu giúp chúng ta truy xuất nhanh hơn. Còn Nonclustered thì ko. Trong 1 table bạn chỉ có thể tạo 1 Clustered và nhiều Nonclustered, cho nên khi bạn tạo table và xác định PK thì PK đó được mặc định là Clustered. Vì thế khi bạn tạo thêm 1 Clustered Index cho table đó thì nó sẽ báo lỗi. Index, hay "chỉ mục" thực chất là một dạng tương tự như phần mục lục của một cuốn sách hay của một cuốn từ điễn vậy, các giá trị trong bảng được sắp theo cột, như vậy với suy nghĩ trên thì nếu cột nào được sắp index thì...

Save And Share :

 
  • It's fine to celebrate success but it is more important to heed the lessons of failure.

  • Followers