tips-and-tricks

Hidden Features of C#?

This came to my mind after I learned the following from this question: where T : struct We, C# developers, all know the basics of C#. I mean declarations, conditionals, loops, operators, etc. Some of us even mastered the stuff like Generics, anonymous types, lambdas, LINQ, ... But what are the most hidden features or tricks of C# th...

Is there any way to configure windows to not change the focus?

I'm tired of being typing something, having a pop-up with a question appear, and hitting enter before reading it... (it also happens with some windows that are not pop-ups) Do you know if there's some setting I could touch for this not to happen? ...

Simplest way to profile a PHP script

What's the easiest way to profile a PHP script? I'd love tacking something on that shows me a dump of all function calls and how long they took but I'm also OK with putting something around specific functions. I tried experimenting with the microtime function: $then = microtime(); myFunc(); $now = microtime(); echo sprintf("Elapsed: ...

Tips and tricks for working with Microsoft Visual Studio solutions and project

After answering on this question I thought it would be nice to collect some tips & tricks for working with MSVS solutions and projects. Here is my list: How to avoid saving new projects automatically to reduce garbage in file system. Uncheck Tools->Options->Projects and Solutions->Save new projects when created How to add common ...

C Code formatting/beautification tool..

When working on large code base with large team, its real challenge to maintain code quality and coding style. well, controlling code quality is a huge topic on its own. But control of code style could be simplified with a tool. We started using indent. Its real neat tool with huge set of options to configure. In the beginning we were ...

How do I stop visual studio from automatically inserting asterisk during a block comment?

I'm tearing my hair out with this one. If I start a block comment ( /* ) in VS.NET 2005+ then carriage return, VS insists that I have another asterisk ( * ). I know there's an option to turn this off but I just can't find it. Anyone know how to turn this feature off? ...

Hidden Features of ASP.NET

There are always features that would be useful in fringe scenarios, but for that very reason most people don't know them. I am asking for features that are not typically taught by the text books. What are the ones that you know? ...

How to "Add Existing Item" an entire directory structure in Visual Studio

I feel ridiculous for asking this because it seems like it should be so simple, however I have been unable to discover an answer to this question. I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure. I want to add them in that format to a different directo...

In C# (or any language) what is/are your favourite way of removing repetition?

I've just coded a 700 line class. Awful. I hang my head in shame. It's as opposite to DRY as a British summer. It's full of cut and paste with minor tweaks here and there. This makes it's a prime candidate for refactoring. Before I embark on this, I'd thought I'd ask when you have lots of repetition, what are the first refactoring op...

Using CSS how best to display name value pairs?

Should I still be using tables anyway? The table code I'd be replacing is: <table> <tr> <td>Name</td><td>Value</td> </tr> ... </table> From what I've been reading I should have something like <label class="name">Name</label><label class="value">Value</value><br /> ... Ideas and links to online samples greatly a...

Emacs equivalent of Vim's yy10p ?

How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once? Any ideas before I go and write my own functions. ...

Adding a guideline to the editor in Visual Studio

Introduction I've always been searching for a way to make Visual Studio draw a line after a certain amount of characters: Below is a guide to enable these so called guidelines for various versions of Visual Studio. Visual Studio 2010 Install Paul Harrington's Editor Guidelines extension. Open the registry at: HKEY_CURRENT_USER\So...

Lua Patterns,Tips and Tricks

This is a Tips & Tricks question with the purpose of letting people accumulate their patterns, tips and tricks for Lua. Lua is a great scripting language, however there is a lack of documented patterns, and I'm sure everyone has their favorites, so newcomers and people wondering if they should use it or not can actually appreciate the ...

What do you do to keep your coding skills in shape, and how often?

What would you say are your best kept secrets to keep yourself in top programming shape? ...

What is the best method to detect offline mode in the browser?

I have a web application where there are number of Ajax components which refresh them selves every so often inside a page (its a dashboard of sorts). Now, I want to add functionality to the page so that when there is no Internet connectivity, the current content of the page doesn't change and a message appears on the page saying that th...

What is your latest useful Perl one-liner (or a pipe involving Perl)?

The one-liner should: solve a real-world problem not be extensively cryptic (should be easy to understand and reproduce) be worth the time it takes to write it (should not be too clever) I'm looking for practical tips and tricks (complementary examples for perldoc perlrun). ...

How do I get a list of tables affected by a set of stored procedures?

I have a huge database with some 100 tables and some 250 stored procedures. I want to know the list of tables affected by a subset of stored procedures. For example, i have a list of 50 stored procedures, out of 250, and i want to know the list of tables that will be affected by these 50 stored procedures. Is there any easy way for doing...

Hidden Features of SQL Server

What are some hidden features of SQL Server? For example, undocumented system stored procedures, tricks to do things which are very useful but not documented enough? Answers Thanks to everybody for all the great answers! Stored Procedures sp_msforeachtable: Runs a command with '?' replaced with each table name (v6.5 and up) sp_ms...

How to get Developers to Share and work together

I work at a small company and we have 2 (possibly 3) developers (myself being one). Although our assignments don't often overlap, I do see that we occasionally write similar, if not the same code. There is also an atmosphere of competition that I think can drive us to write better code, but is dangerous because it sometimes forces one (o...

PHP Optimization Tips

I'm looking for PHP Optimization tips. Coding practices and other methodologies which will make my PHP execute faster. One tip per answer, please, and include why it makes the code faster! This is not about HTML or Javascript execution, but purely server side PHP execution. ...