Monday, January 27, 2014
http://www.jb51.net/list/list_159_1.htm
http://www.aspsnippets.com/jQueryFAQs.aspx?s=1
http://blog-of-darius.blogspot.com/search/label/C%23
Friday, January 10, 2014
.rounded_wrapper { position: relative; } .rounded_wrapper img { border-width: 0; border-style: none; } .rounded_wrapper div { height: 7px; position: absolute; width: 100%; } .rounded_wrapper .tl { top: 0; left: 0; background: url(img/rounded_corners/tl.gif) no-repeat left top; } .rounded_wrapper .tr { top: 0; right: 0; background: url(img/rounded_corners/tr.gif) no-repeat right top; } .rounded_wrapper .br { bottom: 0; right: 0; background: url(img/rounded_corners/br.gif) no-repeat right bottom; } .rounded_wrapper .bl { bottom: 0; left: 0; background: url(img/rounded_corners/bl.gif) no-repeat left bottom; } /* IE6 fix */ .ie6_width .tr { right: -1px; } .ie6_width .br { right: -1px; } .ie6_height .br { bottom: -1px; } .ie6_height .bl { bottom: -1px; }
$('img.rounded').one('load',function () { var img = $(this); var img_width = img.width(); var img_height = img.height(); // build wrapper var wrapper = $(''); wrapper.width(img_width); wrapper.height(img_height); // move CSS properties from img to wrapper wrapper.css('float', img.css('float')); img.css('float', 'none') wrapper.css('margin-right', img.css('margin-right')); img.css('margin-right', '0') wrapper.css('margin-left', img.css('margin-left')); img.css('margin-left', '0') wrapper.css('margin-bottom', img.css('margin-bottom')); img.css('margin-bottom', '0') wrapper.css('margin-top', img.css('margin-top')); img.css('margin-top', '0') wrapper.css('display', 'block'); img.css('display', 'block') // IE6 fix (when image height or width is odd) if ($.browser.msie && $.browser.version == '6.0') { if(img_width % 2 != 0) { wrapper.addClass('ie6_width') } if(img_height % 2 != 0) { wrapper.addClass('ie6_height') } } // wrap image img.wrap(wrapper); // add rounded corners img.after(''); img.after(''); img.after(''); img.after(''); }).each(function(){ if(this.complete) $(this).trigger("load"); });
Asp.net
var persons = new DataTable(); string lastName = string.Empty; DataRow[] foundRows = persons.Select("Person_Id = 100"); if (foundRows.Length == 1) { lastName = foundRows[0]["Last_Name"].ToString(); }
now with LINQ, I have created the following method:
public static T GetFirstResultValue(DataTable table,string colToSearch, string colToReturn, TY searchValue) where TY: IComparable { T ret = default(T); IEnumerable rows = from row in table.AsEnumerable() where row.Field (colToSearch).CompareTo(searchValue) == 0 select row; if (rows.Count() == 1) { ret = (T) rows.First()[colToReturn]; } return ret; }
Friday, December 27, 2013
1, https://github.com/peachananr/autofix_anything
2, http://lirancohen.github.io/stickUp/#installation
3, http://codegeekz.com/top-jquery-plugins/
4, http://thedesignblitz.com/best-jquery-plugins-september-2013/
5, http://craigsworks.com/projects/qtip/docs/tutorials
6, http://fnagel.github.io/MultiDialog/demos/index.html
7, http://swaydeng.github.io/imgcolr/ (https://github.com/swaydeng/imgcolr)
8,http://owlgraphic.com/owlcarousel/#demo
9, http://jquery-plugins.net/
10, http://www.htmldrive.net/
Sunday, December 15, 2013
- Load
- getJson
- GET
- POST
- Ajax

- Cho phép thực hiện gọi với cả hai Request Get và Post
- Cho phép tải các phần của trang.




Monday, December 9, 2013
Posted by Max on Wednesday, September 01, 2010 6:50 AM
If you need to get the identity value from a query, you can use SCOPE_IDENTITY().
In your stored procedure add:
SET @id=SCOPE_IDENTITY()
RETURN @id
and when you create the procedure, declare:
@id int output
-Example-
In this example we create a Stored Procedure to add a new category
(idcategory,categoryname). The procedure return the identity value, in
this case the id of the category:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE [dbo].[anm_InsertCategory] (
@categoryname nvarchar(256),
@idcategory int output
)
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO [anm_Categories] ([category]) VALUES (@categoryname)
SET @idcategory=SCOPE_IDENTITY()
RETURN @idcategory
END
In this way we use the stored procedure in C#:
string strConn = ConfigurationManager.ConnectionStrings["csname"].ToString();
SqlConnection conn = new SqlConnection(strConn);
SqlCommand command = new SqlCommand("anm_InsertCategory", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@categoryname", SqlDbType.NVarChar).Value = cat_name;
command.Parameters.Add("@idcategory", SqlDbType.Int).Direction = ParameterDirection.Output;
conn.Open();
command.ExecuteNonQuery();
string idcat = command.Parameters["@idcategory"].Value.ToString();
Now the value of the string idcat is the identity value of the new
category just added and you can use this value in another query.
Labels: ASP.net, C#, SQL Server 2008 Express
Friday, September 6, 2013
Copy and paste this code into proxy.ashx.cs. using System; using System.IO; using System.Net; using System.Web; namespace WebApplication1 { public class proxy : IHttpHandler { public void ProcessRequest(HttpContext context) { HttpResponse response = context.Response; // Check for query string string uri = Uri.UnescapeDataString(context.Request.QueryString.ToString()); if (string.IsNullOrWhiteSpace(uri)) { response.StatusCode = 403; response.End(); return; } // Filter requests if (!uri.ToLowerInvariant().Contains("wikimedia.org")) { response.StatusCode = 403; response.End(); return; } // Create web request WebRequest webRequest = WebRequest.Create(new Uri(uri)); webRequest.Method = context.Request.HttpMethod; // Send the request to the server WebResponse serverResponse = null; try { serverResponse = webRequest.GetResponse(); } catch (WebException webExc) { response.StatusCode = 500; response.StatusDescription = webExc.Status.ToString(); response.Write(webExc.Response); response.End(); return; } // Exit if invalid response if (serverResponse == null) { response.End(); return; } // Configure reponse response.ContentType = serverResponse.ContentType; Stream stream = serverResponse.GetResponseStream(); byte[] buffer = new byte[32768]; int read = 0; int chunk; while ((chunk = stream.Read(buffer, read, buffer.Length - read)) > 0) { read += chunk; if (read != buffer.Length) { continue; } int nextByte = stream.ReadByte(); if (nextByte == -1) { break; } // Resize the buffer byte[] newBuffer = new byte[buffer.Length * 2]; Array.Copy(buffer, newBuffer, buffer.Length); newBuffer[read] = (byte)nextByte; buffer = newBuffer; read++; } // Buffer is now too big. Shrink it. byte[] ret = new byte[read]; Array.Copy(buffer, ret, read); response.OutputStream.Write(ret, 0, ret.Length); serverResponse.Close(); stream.Close(); response.End(); } public bool IsReusable { get { return false; } } } } Without closing the web browser, append the name of the proxy service and the web resource (highlighted below) that you need access to. For example: http://localhost:51220/proxy.ashx?http://upload.wikimedia.org/wikipedia/en/f/f0/New-esri-logo.jpg
Wednesday, September 4, 2013
Cách làm như sau:
Cách 1:
chuột phải vào biểu tượng Computer chọn properties hoặc gõ lện chuột trái Computer và gõ lệnh Control PanelAll Control Panel ItemsSystem một của sổ hiện ra ở dòng cuối cùng có chữ change product key màu xanh hiện ra bạn clik chuột vào đó cửa sổ mới mở ra sẽ có chỗ nhập key mới bạn nhập key và chọn next chờ một lúc để active key mơi thế là xong nhớ là máy tính phải nối mạng!
Cách 2:
Vì không biết win7 của bro active kiểu gì nên không đưa ra được phương án chính xác. Bạn thử thay đổi Key bằng command line xem.
Vào Start gõ cmd rồi chuột phải lên cmd chọn Run as Administrator
Gõ lệnh :
slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
rồi enter
Trong đó XXXXX-XXXXX-XXXXX-XXXXX-XXXXX là key của bạn.
Để Actived Windows sau khi thay đổi Key gõ tiếp:
slmgr.vbs -ato
Enter
Nếu nó successfully thì OK
Cách 3:
1.Slmgr.vbs –ipk
see more here http://dotnetcluster.blogspot.com/2011/06/auto-refresh-div-using-ajax.html
Friday, June 21, 2013
using iTextSharp.text.html;
using iTextSharp.text.html.simpleparser;
using System.Drawing;
string attachment = "attachment; filename=" + "abc" + ".pdf";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/pdf";
StringWriter s_tw = new StringWriter();
HtmlTextWriter h_textw = new HtmlTextWriter(s_tw);
h_textw.AddStyleAttribute("font-size", "7pt");
h_textw.AddStyleAttribute("color", "Black");
Panel1.RenderControl(h_textw);//Name of the Panel
Document doc = new Document();
doc = new Document(PageSize.A4, 5, 5, 15, 5);
FontFactory.GetFont("Verdana", 80, iTextSharp.text.Color.RED);
PdfWriter.GetInstance(doc, Response.OutputStream);
doc.Open();
StringReader s_tr = new StringReader(s_tw.ToString());
HTMLWorker html_worker = new HTMLWorker(doc);
html_worker.Parse(s_tr);
doc.Close();
Response.Write(doc);
}
}
Labels: C#, iTextSharp