FireFox - We want to set a Guinness World Record
30 05 2008Comments : No Comments »
Categories : күнделік
SQL Server 2000 added the support for user-defined functions, but there are a few limitations which can be roadblocks at first. One is that you cannot use a non-deterministic function within a UDF, e.g. GETDATE(). So, let’s say you are trying to create a function that returns this moment, but a day in the future (e.g. tomorrow at this exact time). You would think about it this way:
CREATE FUNCTION dbo.addDay()
RETURNS DATETIME
AS
BEGIN
DECLARE @dt DATETIME
SET @dt = DATEADD(DAY, 1, GETDATE())
RETURN @dt
END
But you will get this error message:
Server: Msg 443, Level 16, State 1, Procedure addDay, Line 6
Invalid use of ‘getdate’ within a function.
A lot of websites allow users to input text and submit it to the site.
This could be forums, blogs, content management systems etc.
Imaging if the user writes HTML into these form fields?
It could be perfectly harmless when used for styling, but it could also be used the wrong way.
A typical scenario would be when a user enters JavaScript that does harmful things or embedding a style sheet that ruins the websites layout.
This is normally referred to as Cross-Site Scripting (XSS).
We have to mitigate that risk, and that’s when regular expression comes to the rescue.
Here is a very simple method that strips all HTML tags from a string or just the harmful tags - you decide.
App_Code\GData.cs
using System;
using System.Data;
…
public class UserInfo
{
private static string pin;
public static string Pin
{
get { return pin; }
set { pin = value; }
}
private static string fio;
public static string Fio
{
get { return fio; }
set { fio = value; }
}
}
public class QData
{
…
public class GData
{
public static void SetUserInfoPIN(string pin)
{
UserInfo.Pin = pin;
}
public static string GetUserInfoPIN()
{
return UserInfo.Pin;
}
…
}
There is a cool tip/trick, though, that will allow you to load a design-surface for a page that uses nested master-pages. This will allow you to use all of the control-designers and smart-tasks in design-view for the page (for example: to perform data-binding, auto-format things, and use any of the control wizards), and not have to change any-code to test it at runtime.
The tip/trick works by adding a base-page class to your project or solution that defines a new property called “RuntimeMasterPageFile” of type string. The base-class then overrides the page’s “OnPreInit” method and uses this property to set the Page object’s MasterPageFile at runtime:
File structure in C++
typedef struct TAGRECORD
{
char DeviceName[50]; // Имяприбора
char TagName[10]; // Имяпараметра
char TagValue[50]; // Значение
time_t TagTime; // Время записи
int TagChannel; // Канал
int TagInfo; // 0 - info, 1 - control
} TAGRECORD,*LPTAGRECORD;
Read it with Pascal?
Solution >>>
Read the rest of this entry »
Large file uploads in ASP.NET
Uploading files via the FileUpload control gets tricky with big files. The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they’ll get an error message: “Maximum request length exceeded.”
Page.IsPostBack is for forms that are runat=”server”. It is mostly used for same page validation, same page operations, … anything really same page!
It is also used to help keep bandwidth and rendering times down.
The main reason why people use IsPostBack is to stop taping the databases everytime a request is made. If you are on your default page and just do work via that page, you can use the if Not page.ispostback then statements to populate information. When pages are posted back to the sever and then rendered back to the client, they don’t have the need to repopulate the information since it was just populated. It is all kept in the viewstate and read back without using precious resources on the server.
Recent Comments