9/16/2012

Demo Code

public static bool IsValidURL(string strURL) { string regExPattern = @"^^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_=]*)?$"; Regex re = new Regex(regExPattern); return re.IsMatch(strURL); } demo highlight foo bar   Demo Quote...

Save And Share :

8/25/2012

Easy Change the Text Selection Color In Blogger

It very simple to change your select sentence or a single word prevent by default with set as blue color. Now let's start: 1.  Go to Blogger Dashboard > Template > Edit HTML. 2.  Back up your template first if you don't want make some problem :) 3.  Check the Expand Widget Templates checkbox. 4.  Now search (CTRL+F) for the code tag below:  ]]></b:skin>And now add the below code before it ::-moz-selection{background: #9E0ADC;color: white;} ::selection{background: #9E0ADC;color: white;}You can see demo on my blog. Hope you enjoyed doing this trick for your ...

Save And Share :

6/11/2012

Regex quick reference

[abc] A single character of: a, b or c [^abc] Any single character except: a, b, or c [a-z] Any single character in the range a-z [a-zA-Z] Any single character in the range a-z or A-Z ^ Start of line $ End of line \A Start of string \z End of string . Any single character \s Any whitespace character \S Any non-whitespace character \d Any digit \D Any non-digit \w Any word character (letter, number, underscore) \W Any non-word character \b Any word boundary character (...) Capture everything enclosed (a|b) a or b a? Zero or one of a a* Zero or more of a a+ One or more of a a{3} Exactly 3 of a a{3,} 3 or more of...

Save And Share :

Remove Html Tag in C#

You want to remove HTML tags from your string. This is useful for displaying HTML in plain text and stripping formatting like bold and italics, while not removing any actual textual content. Test the methods available for this functionality for performance and correctness with test cases. These C# example programs show how to remove HTML tags from strings.Removing HTML tags from strings Input: <p>The <b>dog</b> is <i>cute</i>.</p> Output: The dog is cute. Performance test for HTML removal HtmlRemoval.StripTagsRegex: 2404 ms HtmlRemoval.StripTagsRegexCompiled: 1366 ms HtmlRemoval.StripTagsCharArray:...

Save And Share :

Remove Html Tag with jQuery

The example below show how to remove HTML tags from strings with jQuery   INPUT:         <b>We</b>love<span>jQuery.</span> OUTPUT:   We love jQuery. jQuery source: var NewString = OriginalString.replace(/(<([^>]+)>)/ig, "");...

Save And Share :

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 :

 
  • I'm a great believer that any tool that enhances communication has profound effects in terms of how people can learn from each other, and how they can achieve the kind of freedoms that they're interested in.

  • Followers