Wednesday, October 31, 2007

.NET Tip of The Day

Interesting kit of .NET tips:
http://dotnettipoftheday.org/tips/

Labels: , , , ,

Speed up Visual Studio 2005

  • Make sure Visual Studio 2005 SP1 is installed.
  • Turn off animation.
    Go to Tools | Options | Environment and uncheck Animate environment tools.
  • Disable Navigation Bar.
    If you are using ReSharper, you don't need VS2005 to update the list of methods and fields at the top of the file (CTRL-F12 does this nicely). Go to Tools | Options | Text Editor | C# and uncheck Navigation bar.
  • Turn off Track Changes.
    Go to Tools | Options | Text Editor and uncheck Track changes. This will reduce overhead and speeds up IDE response.
  • Turn off Track Active item.
    This will turn off jumping in the explorer whenever you select different files in different projects. Go to Tools | Options | Projects and Solutions and uncheck Track Active Item in Solution Explorer. This will ensure that if you are moving across files in different projects, left pane will still be steady instead of jumping around.
  • Turn off AutoToolboxPopulate.
    There is an option in VS 2005 that will cause VS to automatically populate the toolbox with any controls you compile as part of your solution. This is a useful feature when developing controls since it updates them when you build, but it can cause VS to end up taking a long time in some circumstances. To disable this option, select the Tools | Options | Windows Forms Designer and then set AutoToolboxPopulate to False.
  • Disable "Start Page".
    1. Go to Tools | Options.
    2. In Environment | Startup section, change At startup setting to Show empty environment.
  • Disable splash screen.
    1. Open the properties of Visual Studio 2005 shortcut.
    2. Add the parameter /nosplash to the target.
  • Close all unnecessary panels/tabs to prevent them from appearing when the IDE loads.

Labels: , ,

Tuesday, October 16, 2007

ParallelFX and Parallel LINQ (PLINQ) were announced

In October 2007 MSDN Magazine ParallelFX and Parallel LINQ were announced.
Article describes the mechanism of automatic paralleling LINQ to XML и LINQ to Objects queries on multi-core/multi-cpu systems.
In English - Parallel LINQ. Running Queries On Multi-Core Processors.
In Russian - Параллельный LINQ. Выполнение запросов на многоядерных процессорах


ParallelFX - Concurency Runtime (.NET) - System.Concurrency. It realizes paralleling scenarios and eliminating manual application threads creation.
Article
In English - Parallel Performance. Optimize Managed Code For Multi-Core Machines.
In Russian - Параллельная производительность. Оптимизация управляемого кода для многоядерных компьютеров.

Labels: , , , ,

Wednesday, October 10, 2007

Seam Carving. Image Resize Technology.

Революционная и перспективная технология в непропорциональном масштабировании растровых изображений без изменения пропорций объектов на них, была представлена на конференции SIGGRAPH 2007 . Представляли ее Shai Avidan и Ariel Shamir из исследовательской лаборатории Mitsubishi Electric.


Labels: , ,

Wednesday, October 03, 2007

Releasing the Source Code for the .NET Framework Libraries

Microsoft открывает исходные коды многих библиотек .NET Framework - Base Class Libraries (System namespace, IO, Text, Collections, CodeDom, Regular Expressions, etc), ASP.NET, WinForms и WPF(!). В дальнейшем список может быть расширен.
Подробности можно узнать на ScottGu's Blog

Labels: ,

SELECT vs. SET: Optimizing Loops

Loops are fairly common in SQL Server stored procedures. If you discover a loop in a stored procedure, you might find that the code iterates thousands of times before the loop exits. One way to improve the performance of loops is to optimize variable handling.

Do you know the difference between using the SELECT and SET commands to assign values to variables? Many SQL Server developers believe that the commands perform the same function, except that SELECT was designed to return data, whereas SET is optimized to assign values to local variables; therefore, most developers use SET to change variables. This action is correct most of the time.

Certainly, if you're setting a variable's value, SET is the recommended command; however, sometimes SET isn't the best command for the job. Every time you use the SET command, an assignation language element executes. Thus, if you're setting multiple variables, each SET command runs like a SELECT @variable statement. Consider the following two statements, which are functionally equivalent:

SET @iOne = 1;
SET @iTwo = 2;
SET @iThree = 3;
SET @iFour = 4;


SELECT
@iOne = 1,
@iTwo = 2,
@iThree = 3,
@iFour = 4;

Although the statements are similar, the SELECT statement runs significantly faster than the SET statement. Each SET statement runs individually and updates one value per execution, whereas the entire SELECT statement runs as a whole and updates all four values in one execution.

To test this action, I ran each statement in a loop one million times. I found that the SET block ran in 0.0094 milliseconds (ms) on average and the SELECT statement ran in only 0.0039 ms. The SELECT statement ran 59 percent faster than the SET statement. If you're looping through a query only a few hundred thousand times, you probably won't notice a difference between the speed of the two commands; however, the difference in speed might be important to an end user who must wait 10 seconds rather than just 3 seconds for a report to generate.

Another thing to consider is that you can embed your variable updates in preexisting SELECT and UPDATE statements within a loop. In the benchmark tests I ran, each variable that I added to a SELECT or UPDATE statement required an additional 0.00016 ms. By comparison, adding a SET statement required 0.0027 ms. I was surprised to learn that adding a SET statement introduces a processing delay that is 1687.5 percent longer than the processing delay caused by adding a variable to a previously existing SELECT assignation statement. If you're looping through rows, you can further expedite your loop by altering multiple variables in one UPDATE statement, as Listing shows:

UPDATE MyTable SET
Optimized = True,
@iOne = 1,
@iTwo = 2,
@iThree = 3,
@iFour = 4,
@iLoop = @iLoop + 1;

From the February 2007 edition of SQL Server Magazine

Labels: ,

MSSQL2005 & VS2005 feature

Попробуйте скопировать названия столбцов в таблице в режиме modify (я так пробовал) из SQL Server 2005
И вставить в aspx страничку (HTML view) в VS 2005
Посмотрите что получилось и обратите вниманиe на новые записи в web.config’е ;)

Labels: , , ,

Tuesday, October 02, 2007

Visual Studio 2005 Tips & Tricks

Нашел для себя пару новых штучек, может для кого-то новых будет больше...

1. Вертикальное выделение текста
Наверное одна из моих самых любимых функций редактора Visual Studio – выделение текста колонками, а не строками. Нажмите Alt и левую клавишу маши и выделяйте текст колонкой.

2. Альтернативный поиск строк
Нажмите Ctrl + I и начинайте вводить некоторый текст. Будут выделяться совпадающие символы первого вхождения строки от положения курсора и ниже.

3. Множественное копирование
Иногда так хочется скопировать в буфер обмена несколько строк сразу, а потом, перейдя к другому файлу вставлять скопированные строки в произвольном порядке. Visual Studio умеет и это!
Для начала выделите некоторый фрагмент кода и скопируйте его в буфер (Ctrl + C), после этого выделите другой фрагмент и скопируйте его тоже. Ну и еще один, интереса ради.
Теперь установите курсор ввода куда-нибудь еще и зажмите клавиши Ctrl + Shift и нажимайте клавишу V (не отпуская Ctrl + Shift). Вы увидите, что вставляемые фрагменты циклично чередуются.

4. Копирование текста на Toolbox и с Toolbox
Великий и могучий Drag & Drop при редактировании кода также может быть не менее полезен, чем при добавлении контролов на форму. Вы можете выделить кусочек текста и перетащить его на панель Toolbox, чтобы потом, также перетаскивая, вставлять куда угодно. Еще один удобный аналог стандартного буфера обмена.

5. Быстрое комментирование/раскомментирование фрагментов кода
Выделите фрагмент кода, который хотите закоментировать и нажмите Ctrl + K, C (удерживая Ctrl нажать K, затем C ). Для снятия комментариев нужно выделить закомментированный кусок и нажать Ctrl + K, U.

6. Отображение IntelliSense
Если вы хотите отобразить IntelliSense, то нужно нажеть Ctrl + J. Это может пригодится, если по каким-то причинам подсказка не отображается (вы на «полуслове» наступили «на горло песне», то есть нажали Esc).

7. Перемещение между открывающими/закрывающими скобками
Установите курсор ввода на скобку, для перехода на ее пару нажмите Ctrl + ]. Это же работает для многострочных комментариев (/* */), регионов (# region # endregion ) и кавычек, обрамляющих строки.

8. Сворачивание/разворачивание блока (региона, функции, цикла и т.п.)
Если вам лениво ползать мышью до значка +/-, то нажатие Ctrl + M, M (удерживая Ctrl нажать M два раза) сделает то, что нужно. Ctrl + M , L позволяет свернуть/развернуть все блоки

Labels: , ,

10 Usability Nightmares You Should Be Aware Of

Вот тут довольно неплохой обзор того как не надо делать сайты:
http://www.smashingmagazine.com/2007/09/27/10-usability-nightmares-you-should-be-aware-of/
А вот тут уже успели эту статью перевести:
http://blog.perfectomania.com/usability/10-yuzabiliti-koshmarov-kotoryx-vy-dolzhny-izbegat/

Labels: ,

Visual Studio 2005 Tips & Tricks

Для того, чтобы быстро подключить отладчик Visual Studio к процессу ASP.NET(aspnet_wp.exe) можно использовать следующую комбинацию.

ALT + D, P "AS" ENTER

ALT + D, P - откроет диалог "Attach to Process"
"AS" - если нажать эти две буквы, то выделение перейдет на процесс aspnet_wp.exe
ENTER - приаттачит отладчик к процессу ASP.NET

После нескольких повторений переход в режим отладки занимает ~1 секунды

Labels: , , ,