Saturday, July 17, 2010

Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out

The server request timed out


"Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out"


Getting  "Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out"

,when using a updatepanel. Why is that?


<add verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false"/>

 Possible Causes to this error are-

  • The export operation was relatively long (something like 2 minutes)
  • Ajax Extension Callback framework had a timeout.
  • Do you have a particularly long running process on the server? Sounds like the PageRequestManager was waiting for a response and it didn't come back
  • Probably you are running a server-side C# code and a client-side-script by a control like a Button all together.
  • Or maybe you have written a client-side-script for a control which is placed in an updatePanel.

Possible Solutions to this error are-

  • Try this in ur webconfig file.

                   <httpRuntime maxRequestLength="1024000" executionTimeout="999999"/>

  • Try to solved it using three line of code in asp.net

                    1) <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout ="360000"></asp:ScriptManager>       


                    2)<httpRuntime executionTimeout="360000"/>

  • If you are running a server-side C# code and a client-side-script by a control like a Button all together.Or maybe you have written a client-side-script for a control which is placed in an updatePanel.

                 So Avoid them;

  • Maximize the timeout to 10 hours

                  <asp:ScriptManager ID="ScriptManager1" AsyncPostBackTimeOut="36000" runat="server" />

 

SanDisk's SD card can store data for 100 years

PERIPHERALS

SanDisk's SD card can store data for 100 years

Jun 23, 2010 11:15 am | IDG News Service

The cards can be written on only once
by Agam Shah

SanDisk on Wednesday announced a Secure Digital card that can store data for 100 years, but can be written on only once.

The WORM (write once, read many) card is "tamper proof" and data cannot be altered or deleted, SanDisk said in a statement. The card is designed for long-time preservation of crucial data like legal documents, medical files and forensic evidence, SanDisk said.

The media comes with capacity of only 1GB. SanDisk determined the media's 100-year data-retention lifespan based on internal tests conducted at normal room temperatures.

To draw comparisons, the card is like DVD-write only media, but much smaller and with a much longer life span. SD cards typically slot into portable devices like digital cameras and mobile phones to store or move images, video or other data. The WORM works like conventional SD media, but only with compatible devices, SanDisk said.

The company said it is shipping the media in volume to the Japanese police force to archive images as an alternative to film, SanDisk said. The company is working with a number of consumer electronics companies including camera vendors to support the media.

The media is available worldwide through resellers. SanDisk did not comment on pricing.

Cyber attacks: India is the most 'peaceful' nation

Cyber attacks: India is the most 'peaceful' nation

According to a SecureWorks study, the United States is responsible for the largest number of attempted cyber attacks in the last six months

Thursday, July 08, 2010

BANGALORE, INDIA: SecureWorks announced the findings of a research study that analyzed where the greatest number of attempted cyber attacks were launching from across the globe at its 2,800 clients.

India won the study by having the lowest number of attempted cyber attacks originating from computers within its borders with only 52 attacks per thousand PCs.

The Netherlands ended in second place with 57 attacks per thousand PCs, narrowly beating Germany and Brazil who came in third and fourth place respectively, said the study. France came fifth 106 attacks, while the UK came sixth with 107 attacks per 1000 PCs, more than double the level of 52 attacks per 1000 PCs in India.

Also read: Hacking:India needs to step up cyber offensive

Jon Ramsey, SecureWorks' chief technology officer, said that the statistics show that a substantial number of vulnerable computers in countries worldwide have been compromised and are being used as bots to launch cyber attacks.

“Overall, the study shows that not only are organizations and individuals putting themselves at risk by not securing them, but they are actually providing cyber criminals with a platform to compromise other computers,” he said.

“The reasons for the difference in number of attempted attacks per country could comprise many things - this ranges from the overall Internet speeds in a country and how proactive the ISPs are in protecting their clients to general user education on security. The ratio of Windows, Mac and Linux users in a country will also make a big difference,” he added.

According to the study, the United States is responsible for the largest number of attempted cyber attacks in the last six months, with a total of 1,660 attempted attacks per thousand computers.

According to SecureWorks, there are a variety of techniques that can be introduced to help secure systems and prevent attacks. A multi-layered solution provides compensating controls that can help reduce data loss.

Traditional methods such as firewalls and anti-virus software should be combined with intrusion prevention services, access control, data encryption, tokenization, vulnerability scans, network segmentation and log monitoring to perform a rich analysis of networks and effectively protect systems, it said.

©CIOL Bureau

Autogenerate Code Using T4 in VS 2010

Autogenerate Code Using T4 in VS 2010

The Text Template Transformation Toolkit, or T4 is a solution that reduces the repetitive work of a developer by creating a template that auto-generates code from a set of rules, other code, or data input

Friday, July 16, 2010

BANGALORE, INDIA: If you look at the work that a normal developer does most of the time, it's a fairly repetitive job wherein he writes code for doing a particular module which is similar to everything else that is done with small differences being say, the fields that need to be displayed/updated to a different table in a different database. There are many other things that are similar as well.

However, there is a way to not just automate this work so that the developer has to only fill in the requirements and the code gets generated, but also ensure that the code is up to standards as defined by policy. This can make the architect's and project manager's, not to mention the developer's life also much better. There is a technology in the .NET world that allows you to do this called T4.

T4 is an abbreviation for Text Template Transformation Toolkit. This is way of writing a 'template' that can generate code from a set of rules, other code, or data input. You can write a template that can be used multiple times with a slight change in input which will output code for different scenarios. Fairly complex scenarios are possible by using this. Let's start with some simple examples and then move on to some more complex ones to see how they work.

First of all, fire up Visual Studio 2010 (or Visual Studio 2008 with the free T4 Toolbox  installed). Note that in VS2008, you will not see an item type in the new item list and will need to create a text file yourself. In VS2010, simply create an 'Empty Project' and then add a new item of type 'Text Template'. This will create a new file with the extension of '.TT'. When the file opens in VS, you will see the following lines:

<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".txt" #>

There are a couple of things to note here. The language attribute in the first line specifies that language that is going to be used for creating the template ? not the language that is the output. The extension attribute in the second line specifies the type of file that is going to be generated. Expand the .TT file you created in Solution Explorer and you'll see a .TXT file with the same name. Now change the value in the extension to say '.cs' and it will change the file as well. Change the .TT file to the following:

<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".cs" #>
using System;
namespace Hello
{
class Program
{
public void Main()
{ Console.WriteLine("Hello World"); }}}

As soon as you save the file, open up the associated .CS file. You should see the entire code (other than the T4 directives at the top) generated for you. Congrats, you've just auto-generated your first piece of code.

Text Template item type in VS 2010


 

However, this is not really impressive right now. You've actually written more than what the code actually is. But think of a case where you might need to write this exact same code out, but just change the message that is shown. For this, you now need to start writing T4 code itself to allow the template to accept parameters and use them in the code generation.

Modify the code above by changing the Writeline line and adding the following:

{ Console.WriteLine("<#= this.Message #>");}}}
<#+
string Message = "Hi There";
#>

When you save this file and open the .CS one, you will see that the message has indeed changed. The '<#=' and the '<#+' signs are some T4 directives to tell the T4 compiler what needs to be done. Now by simply changing the value in the Message variable, you can output different code files each time.


An autogenerated ASP.NET WebForm using a T4 template

You can also include other code files to your own. For instance, you might want to generate this file after some other processing. So create a new .TT file, say MyTest1.tt and have the following within it:

<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".cs" #>
<#
this.Message = "Hallo Welt!";
#>
<#@ include file="HelloWorld.tt" #>

Open the MyTest1.cs file, and you'll find a German version of the 'Hello World' message. You can of course go ahead and generate a bunch of code more complex than this of course. As an example, let's take a look at some templates that automatically generate ASP.NET files - both ASPX and ASPX.CS  - for working with a database table. For code generation, the developer simply needs to change an XML file that defines the table and the fields.

A number of T4 template files are needed in this case:

1.WebFormFields.tt: Generates the frontend ASPX and HTML code

2.CodeBehindFields.tt: Generates backend database connectivity code (for this article only displays field name)

3.SaveOutput.tt: Saves the ASPX and ASPX.cs file in the current directory

4.BuildPagesFromXML.tt: Reads the XML file for fields and then uses the other T4 files to generate

The code in each (abbreviated) looks like this:

WebFormFields.tt

<#+ void GenerateASPXField(string FName, string Type, string Choices) { #>
:
<#+ switch (Type) {
case "Text": #>
<#+ break; case "List": #>
<#+ string[] items = Choices.Split(';'); for (int i = 0; i < items.Length; i++) { #>
<#= items[i] #>
<#+ } #>
<#+ break; default: break; }} #>

This code defines a T4 function that simply outputs a textbox and a dropdownlist for fields defined as such in an XML file.

CodeBehindFields.tt
<#+ void GenerateCBFieldSave(string FName, string Type, string Choices) {
switch (Type) {
case "Text": #>
Response.Write("Field <#= FName #>; Value= " + txt<#= FName #>.Text);
<#+ break; case "List": #>
Response.Write("Field <#= FName #>; Value= " + ddl<#= FName #>.SelectedValue);
<#+ break; default: break; } } #>


Another autogenerated Webform using the same T4 template

This defines a T4 function that simply outputs the fieldname and associated value.

SaveOutput.tt
<#@ template language="C#" hostspecific="true" #>
<#@ import namespace="System.IO" #>
<#+
void SaveOutput(string outputFileName)
{
string templateDirectory = Path.GetDirectoryName(Host.TemplateFile);

string outputFilePath = Path.Combine(templateDirectory, outputFileName);
File.WriteAllText(outputFilePath, this.GenerationEnvironment.ToString());

this.GenerationEnvironment.Remove(0, this.GenerationEnvironment.Length);
}
#>

This defines a function that saves both the ASPX and ASPX.cs files when called.

BuildPagesFromXML.tt

This code will need to generate the standard ASP.NET header and footer for both files and also the generated code by including the files above. The main code for generating the fields looks like this:

foreach (XmlNode node in doc.SelectNodes("/Fields/Field"))
{
FieldName = node.Attributes["Name"].InnerText;
Type = node.Attributes["Type"].InnerText;
switch (Type)
{
case "Text":
GenerateASPXField(FieldName, Type, "");
break;
case "List":
GenerateASPXField(FieldName, Type, node.Attributes["Choices"].InnerText);
break;
}
}
SaveOutput(WebFormName + ".aspx");
foreach (XmlNode node in doc.SelectNodes("/Fields/Field"))
{
FieldName = node.Attributes["Name"].InnerText;
Type = node.Attributes["Type"].InnerText;
switch (Type)
{
case "Text":
GenerateCBFieldSave(FieldName, Type, "");
break;
case "List":
GenerateCBFieldSave(FieldName, Type, node.Attributes["Choices"].InnerText);
break;
}
}
SaveOutput(WebFormName + ".aspx.cs");

The input XML file looks like this:

As you change the form name and the fields, a new Name.aspx and Name.aspx.cs files with the correct front and backend code will be generated in the directory. As the entire set of templates was too large for this article, I'll be uploading the solution to the PCQ Forums where you can pick it up.

T4 templates are powerful ways of automating and standardizing code generated in your company's projects. You can use this to enhance productivity as well as let developers work on better value additions to the project that doing the same repetitive job everyday.

©PCQuest

If it's your app, better patent it

If it's your app, better patent it

EBay Inc sued for at least $3.8 billion in PayPal patent case
Thursday, July 15, 2010

NEW York: EBay Inc was sued for at least $3.8 billion by a Connecticut company that accused the online auctioneer and retailer of infringing six patents to develop lucrative payment systems such as PayPal.

According to the complaint filed Tuesday by XPRT Ventures LLC in the federal court in Delaware, eBay allegedly stole information shared in confidence by the inventors on XPRT's own patents, and incorporated it into features in its own payment systems, such as PayPal Pay Later and PayPal Buyer Credit.

XPRT said that when eBay on April 30, 2003 filed a patent application titled "Method and System to Automate Payment for a Commerce Transaction," it failed to tell the U.S. Patent and Trademark Office it knew of XPRT's own patent applications.

By filing for a similar patent, eBay "admitted the patentability of the inventors' claims," the complaint said.

"This involves a trade secret theft, along with sheer patent infringement," said Steven Moore, a partner at Kelley Drye & Warren LLP representing the plaintiff, in an interview. "It is bad enough to take someone's technology, but it is a bit much to use it in your own patent application."

EBay did not immediately return calls and an email seeking comment.

According to its latest annual report, eBay's payments business generated $2.8 billion of net revenue in 2009, or 32 percent of the company's $8.73 billion total.

XPRT is seeking a minimum $3.8 billion in monetary damages, based on their estimated present value. It is also seeking treble damages resulting from eBay's alleged "willful and malicious conduct," punitive damages, and other remedies.

The complaint also names eBay affiliates PayPal, Bill Me Later, Shopping.Com and StubHub as defendants.

XPRT is based in Greenwich, Connecticut, and eBay in San Jose, California.

Shares of eBay closed Tuesday up 80 cents, or 4 percent, at $21.02 on the Nasdaq.

The case is XPRT Ventures LLC v. eBay Inc et al, U.S. District Court, District of Delaware. A case number was not immediately available.



©CIOL Bureau

HTML5: Features and Capabilities

HTML5: Features and Capabilities
Opera, Firefox, and IE 9 (preview only) already support it, and lots of websites are already using it. So what are you waiting for? We delve into its features and capabilities to get you started

BANGALORE, INDIA: The buzz around HTML 5 is getting louder by the day. Most major browsers have already started supporting it, and many companies have already embedded it in their websites. It's time you also started exploring its capabilities before everyone gets on the bandwagon and leaves you behind. Here, we discuss everything about its features and capabilities.

Who is behind HTML5?

HTML5 is a decentralized concept and is promoted by WHATWG (Web hypertext Application technology working group). This group was formed in June 2004 after a disagreement within the W3C group due to the deviation in ideas of some members from HTML to XHTML. And many top people from Mozilla, Google and Apple did not want to leave HTML as a standard and hence they formed WHATWG.

HTML5's development started in 2004 and is not released yet. But few browsers have already started supporting it so you can play around with its new features. HTML5 is no doubt one of the most talked about buzz word on Internet today and it claims to change the way web applications are developed by making them stronger.

Features at a glance

Doctype: HTML5 suggested the removal of various doctypes and recommends sticking to the following.

Generic structure of a webpage: Almost every website has very similar page structure viz header, navigation (also called menu), content section and the footer.  HTML5 has them defined as generic tags, so that every time a new webpage is created, you do not have to define the div, span, id, class etc for these portions of the webpage.

New Controls: With the advent of HTML5 some new controls are introduced. These are the controls which are commonly used on a webpage, but at present a developer has to write code for them on each & every webpage he develops.

Less error prone code: As mentioned above, there are a few new controls which are there by default in HTML5, such that a developer does not have to write a code for it. This results in making a web application more robust as a developer has to write less number of lines of code compared to what he used to write before HTML5. We will illustrate this later through examples.

Productivity: Most of the time a web developer struggles to achieve cross browser compliance for his web application. This results in wasting a lot of productive time, because he has to tweak his code over and again so that it behaves the same way across  different browsers. We will see how HTML5 is going to help in making application cross browser compatible.   At present, we define the structure of a page  using div, span. Then we style the page using cascade style sheet (CSS) using the Id, class which are defined in the HTML. But let me show you how you can define the HTML & CSS for the image page layout in HTML5.

HTML (say index.html)

header Tag



nav tag used to display left navigation

section tag

article tag

footer tag

The above is a sample HTML code showing the new tags, header, nav, section, article, and footer.

You might have already noticed that the above code does not contain any div or span tags. But still it gives you the same effect as a conventional div like page structure would have given. The CSS properties can be defined with the names of the tags. Now let's see the CSS code which styles a webpage.

body {background-color:white; color: black; text-align:center;}

header, footer, nav, section, article {display:block;border: 1px solid black;}

header {width:100%; background-color:blue;}

header h1{margin: 0px;padding: 0px;color: #fff;}

nav {width:30%; background-color:#8182CF;float:left;}

section {width:69%; background-color:SpringGreen ; float:right;height: 232px;}

article {width:70%; margin:2em 10%; background-color:turquoise;}

p{font-size: 22px;}

footer {width:100%; background-color:pink; clear:both;}

Now create a blank HTML file and type the new HTML tags as written above along with this CSS code. You will be able to see the webpage similar to what is shown in the image.

Note:  Open your HTML file in Firefox, Opera, Chrome or even in Safari browser. If you try to open this HTML file in IE, you will not get the expected result, because these tags are not yet supported in IE. However, there is a workaround in JavaScript to make these tags work even in IE. Let's see how we can achieve this.

New Controls

HTML5 has introduced many new controls which makes the life of a web developer easier. Out of the many new controls introduced, I am going to show the ones I like the most.

DatePicker: If you are a developer, then you might have a pet JavaScript which renders a nice datepicker on the webpages you create. The script which you include, no doubt sends a HTTP request, downloads the resources and then renders. That adds into page load time and results in slower rendering of the webpage. But in HTML5, you can include this fancy datepicker by simply adding the type=?date? in the input tag.


Slider Control: HTML5 also has the control to insert the slider, if needed. Those who use sliders are using readymade JQuery plugins or either building their sliders from scratch. So that again is expensive in terms of productivity.

Productivity: Most of the time a web developer struggles to achieve cross browser compliance for his web application. This results in wasting a lot of productive time, because he has to tweak his code over and again so that it behaves the same way across  different browsers. We will see how HTML5 is going to help in making application cross browser compatible.   At present, we define the structure of a page  using div, span. Then we style the page using cascade style sheet (CSS) using the Id, class which are defined in the HTML. But let me show you how you can define the HTML & CSS for the image page layout in HTML5.

HTML (say index.html)

header Tag



nav tag used to display left navigation





section tag



article tag





footer tag

The above is a sample HTML code showing the new tags, header, nav, section, article, and footer.

You might have already noticed that the above code does not contain any div or span tags. But still it gives you the same effect as a conventional div like page structure would have given. The CSS properties can be defined with the names of the tags. Now let's see the CSS code which styles a webpage.

body {background-color:white; color: black; text-align:center;}

header, footer, nav, section, article {display:block;border: 1px solid black;}

header {width:100%; background-color:blue;}

header h1{margin: 0px;padding: 0px;color: #fff;}

nav {width:30%; background-color:#8182CF;float:left;}

section {width:69%; background-color:SpringGreen ; float:right;height: 232px;}

article {width:70%; margin:2em 10%; background-color:turquoise;}

p{font-size: 22px;}

footer {width:100%; background-color:pink; clear:both;}

Now create a blank HTML file and type the new HTML tags as written above along with this CSS code. You will be able to see the webpage similar to what is shown in the image.

Note:  Open your HTML file in Firefox, Opera, Chrome or even in Safari browser. If you try to open this HTML file in IE, you will not get the expected result, because these tags are not yet supported in IE. However, there is a workaround in JavaScript to make these tags work even in IE. Let's see how we can achieve this.

New Controls

HTML5 has introduced many new controls which makes the life of a web developer easier. Out of the many new controls introduced, I am going to show the ones I like the most.

DatePicker: If you are a developer, then you might have a pet JavaScript which renders a nice datepicker on the webpages you create. The script which you include, no doubt sends a HTTP request, downloads the resources and then renders. That adds into page load time and results in slower rendering of the webpage. But in HTML5, you can include this fancy datepicker by simply adding the type=?date? in the input tag.


Slider Control: HTML5 also has the control to insert the slider, if needed. Those who use sliders are using readymade JQuery plugins or either building their sliders from scratch. So that again is expensive in terms of productivity.

But the HTML5 allows you to embed a slider with minimum and maximum values defined. One such example is shown below.




Audio & Video: It is hard to embed Audio or Video on to your web page. First of all you require a script which allows you to stream the media files on your webpage. And on the other hand, the visitors need to install the plugins into their browsers to successfully view/listen the media you embedded. Overall it's a pain for both the developer and the user.  HTML5 has the solution by allowing developers to embed Audio & Video files directly into a webpage with simple tags.

The above code embeds an audio player which plays the sample.ogg audio sample after clicking the play button. And the same is true for the following video tag.

Less code and productivity:There is major improvement in the way we define HTML forms. Almost every form created on a webpage to take input from the user requires validation. For the client side validation the developers have to write JavaScript code and this code is repeated in almost every website, one way or the other. But with the introduction of ?required? attribute, one can rely on the browser to handle such validations. The following code is an example of validation :


















So the above lines of code are enough for validating the empty field, valid email address and a valid URL. You do not have to write JavaScript code, which not only makes your HTML page lighter but also the built-in validation of the browser ensures lesser bugs in the final code. Productivity is increased since the developer does not have to repeat the same code for each and every form and then calling events and functions etc.

Note: For all the demos shown in this article, we are using Opera v10.5. You will be able to see some of the HTML5 tags working in Firefox as well, but for now Opera supports all of them. Unfortunately IE does not support any of the tags as of now.

Sachin Khosla, Founder, Digimantra.com

©CIOL Bureau

 



Popular Posts