All Questions

1 vote
3 answers
3k views

How can you tell if viewstate in an ASP.Net application has been tampered with?

During a discussion about security, a developer on my team asked if there was a way to tell if viewstate has been tampered with. I'm embarrassed to say that I didnt know the answer. I told him I would ...
Kilhoffer's user avatar
  • 32.7k
11 votes
7 answers
15k views

How do you write a C# Extension Method for a Generically Typed Class

This should hopefully be a simple one. I would like to add an extension method to the System.Web.Mvc.ViewPage< T > class. How should this extension method look? My first intuitive thought is ...
Matt Mitchell's user avatar
50 votes
11 answers
122k views

Working with USB devices in .NET

Using .Net (C#), how can you work with USB devices? How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write). Is there a native .Net solution ...
David Thibault's user avatar
11 votes
6 answers
18k views

Good pattern or framework for adding auditing to an existing app? [closed]

I have an existing J2EE enterprise application to which I need to add auditing, i.e. be able to record CRUD operations on several important domain types (Employee, AdministratorRights, etc.). The ...
Andrew Swan's user avatar
  • 13.6k
11 votes
17 answers
1k views

PHP: Can I reference a single member of an array that is returned by a function?

any idea how if the following is possible in PHP as a single line ?: <?php $firstElement = functionThatReturnsAnArray()[0]; ... It doesn't seem to 'take'. I need to do this as a 2-stepper: <?...
user avatar
1 vote
6 answers
2k views

What's the best way to extract table content from a group of HTML files?

After cleaning a folder full of HTML files with TIDY, how can the tables content be extracted for further processing?
lyates's user avatar
  • 177
1 vote
2 answers
1k views

DefaultButton in ASP.NET forms

What is the best solution of defaultButton and "Enter key pressed" for ASP.NET 2.0-3.5 forms?
dimarzionist's user avatar
  • 18.6k
42 votes
7 answers
51k views

How can I print a binary value as hex in TSQL?

I'm using SQL Server 2000 to print out some values from a table using PRINT. With most non-string data, I can cast to nvarchar to be able to print it, but binary values attempt to convert using the ...
Tadmas's user avatar
  • 6,338
64 votes
10 answers
30k views

CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET

Why does the following code sometimes causes an Exception with the contents "CLIPBRD_E_CANT_OPEN": Clipboard.SetText(str); This usually occurs the first time the Clipboard is used in the application ...
3 votes
8 answers
1k views

Algorithm for finding characters in the same positions in a list of strings?

Suppose I have: Toby Tiny Tory Tily Is there an algorithm that can easily create a list of common characters in the same positions in all these strings? (in this case the common characters are 'T' ...
ilitirit's user avatar
  • 16.3k
93 votes
13 answers
49k views

How to stop PHP replacing dot characters in GET, POST, or COOKIE names?

If I pass request fields or cookies with a period/dot in their names, PHP auto-replaces them with underscores. For example, if I put this code at https://example.com/test.php?x.y=a.b: <?php echo $...
user avatar
2586 votes
27 answers
1.7m views

Class (static) variables and methods

How do I create class (i.e. static) variables or methods in Python?
Andrew Walker's user avatar
32 votes
4 answers
24k views

Can you have a class in a struct?

Is it possible in C# to have a Struct with a member variable which is a Class type? If so, where does the information get stored, on the Stack, the Heap, or both?
Mark T's user avatar
  • 3,474
20 votes
16 answers
34k views

Regex that Will Match a Java Method Declaration

I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the ...
Anton's user avatar
  • 12.4k
324 votes
9 answers
144k views

Are tuples more efficient than lists in Python?

Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements?
readonly's user avatar
  • 351k

15 30 50 per page