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
Saturday, June 15, 2013
This is my version of a class that displays a check box in a DataGridView Header cell.
This is based on the code from http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/827907ea-c529-4254-9b15-2e6d571f5c5b
It assumes that the check box is located in the first DataGridView
column. It allows for column caption and provides built-in
check/uncheck functionality. Play with x and y parameters to place the
checkbox where you want in the header cell.
Here is a usage example:
The class listing:
Saturday, June 8, 2013
1) Open Notepad
2) Paste below code
Call LogEntry()
Sub LogEntry()
On Error Resume Next
Dim objRequest
Dim URL
Set objRequest = CreateObject("Microsoft.XMLHTTP")
URL = "http://www.YourDomain.com/track.aspx"
objRequest.open "POST", URL , false
objRequest.Send
Set objRequest = Nothing
End Sub
3) Save page as *.vbs
4) Schedule this task using Windows Task Scheduler
Start-> All Programs-> Accessories-> System Tools-> Scheduled Tasks.
To schedule a new task:
1. Double-click Add Scheduled Task to start the Scheduled Task Wizard, and then click Next in the first dialog box.
2. The next dialog box displays a list of programs that are installed
on your computer, either as part of the Windows XP operating system, or
as a result of software installation.
Use one of the following procedures:
* If the program that you want to run is listed, click the program, and then click Next.
* If you want to run a program, script, or document that is
not listed, click Browse, click the folder and file that you want to
schedule, and then click Open.
3. Type a name for the task, and then choose one of the following options:
* Daily
* Weekly
* Monthly
* One time only
* When my computer starts (before a user logs on)
* When I log on (only after the current user logs on)
4. Click Next, specify the information about the day and time to run the task, and then click Next.
Note that the information about the day and time to run the task
vary depending on the selection that you made in the previous wizard
dialog box. For example, if you chose Weekly, you must indicate the day
of the week, the time, and if the task should run every week, every 2
weeks, every 3 weeks, and so on.
5. Type the name and password of
the user who is associated with this task. Make sure that you choose a
user with sufficient permissions to run the program. By default, the
wizard selects the name of the user who is currently logged on.
6. Click Next, and then click Finish after you verify the choices that you have made.
Using Advanced Options in Scheduled Tasks
If
you want to change the configuration of the task, click Open in the
advanced properties for the task before you click Finish. After you
click Finish, the Properties dialog box opens for the task.
On
the Schedule tab, you can change any of the scheduling options that you
chose in the wizard, and you can also change the task configuration so
that the task does not run too long, does not run if the computer is
running on batteries (for laptops), and to specify whether or not the
computer should be idle for the task to run.
NOTE: You can open
the Properties dialog box for the task at any time if you open Scheduled
Tasks, right-click the task, and then click Properties.
You
cannot schedule a task so that it repeats in an interval less than one
day; however, you can do this in the Properties dialog box:
1. Click the Schedule tab, and then click Advanced.
2. Click to select the Repeat task check box, and then specify the
number of minutes or hours in which you want the task to be repeated.
Schedule a Windows Task to call an ASP.NET web page - ASP.NET - VB.NET, Windows Task Scheduler
0 comments Posted by Duc Nguyen at 5:56 PMThe following is how you
can schedule a windows task that can call an ASP.NET web page. Usually
we want to schedule task from Windows. I have seen lots of questions
regarding this in the past.
The cool thing about
Windows task is that you can execute custom jobs to be executed in the
server without the need of a user to be logged in.
The following code can
be used to call ASPX web pages to run a specific job that needs to
execute some sort of logic. The script is written in VB.NET, but the web
page can be written with C# as the vbscript only is used to create the
call from the server to the page.
The steps are as follow:
- Write the Script (VB in this case)
- Create an ASP.NET page
- Schedule the task through the VBS Script
On Error Resume Next
To schedule a new task:
- Double-click Add Scheduled Task to start the Scheduled Task Wizard, and then click Next in the first dialog box.
- The next dialog box
displays a list of programs that are installed on your computer, either
as part of the Windows XP operating system, or as a result of software
installation.
Use one of the following procedures:- If the program that you want to run is listed, click the program, and then click Next.
- If you want to run a program, script, or document that is not listed, click Browse, click the folder and file that you want to schedule, and then click Open.
- Type a name for the task, and then choose one of the following options:
- Daily
- Weekly
- Monthly
- One time only
- When my computer starts (before a user logs on)
- When I log on (only after the current user logs on)
- Click Next, specify the information about the day and time to run the task, and then click Next.
Note that the information about the day and time to run the task vary depending on the selection that you made in the previous wizard dialog box. For example, if you chose Weekly, you must indicate the day of the week, the time, and if the task should run every week, every 2 weeks, every 3 weeks, and so on. - Type the name and password of the user who is associated with this task. Make sure that you choose a user with sufficient permissions to run the program. By default, the wizard selects the name of the user who is currently logged on.
- Click Next, and then click Finish after you verify the choices that you have made.
Using Advanced Options in Scheduled Tasks
On the Schedule tab, you can change any of the scheduling options that you chose in the wizard, and you can also change the task configuration so that the task does not run too long, does not run if the computer is running on batteries (for laptops), and to specify whether or not the computer should be idle for the task to run.
NOTE: You can open the Properties dialog box for the task at any time if you open Scheduled Tasks, right-click the task, and then click Properties.
You cannot schedule a task so that it repeats in an interval less than one day; however, you can do this in the Properties dialog box:
- Click the Schedule tab, and then click Advanced.
- Click to select the Repeat task check box, and then specify the number of minutes or hours in which you want the task to be repeated.
I hope you can find this useful.