Microsoft Visual Studio 2010 Beta 2 is available for MSDN Subscribers!

by Vitaly Zayko 19. October 2009 21:21

VS_v_rgb_ai If you are lucky MSDN Subscriber, you can download VS2010 as well as TFS2010 right now! I already did.
BTW: TFS2010 has "go live" license which means you can use it in your daily work instead of just testing purposes. Here are more details: Brian Keller's blog.
If you don't have the subscription, you just need little wait - it will be available for everyone in October 22nd.

Technorati Tags:
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

General

Most useful Windows 7 shortcut keys

by Vitaly Zayko 22. September 2009 11:46

I’m a happy MSDN subscriber so have Windows 7 installed for few months by now and got some useful shortcuts to share.

  • Multi monitor system? Use Win+Shift+Left to move to the left monitor or Win+Shift+Right – to the right
  • Win+P – switches between monitor options (multi monitor/projector settings)
  • One monitor? Then Win+Left is snapping current window to the left side and Win+Right – to the right
  • Win+Space – peeks at the Desktop
  • Win+X – calls Mobility Center
  • Win+T – first Taskbar entry
  • Win+G – brings desktop gadgets to the top

Enjoy!

Technorati Tags:
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

General

How to boot Windows 7 faster?

by Vitaly Zayko 4. September 2009 12:54

Check your system configuration: active services, what items run at startup ect. All of those are in one place: MSCONFIG.

MSCONFIG in Microsoft Windows 7

Technorati Tags:
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

General

How to enable menu “Create GUID” in Visual Studio 2008

by Vitaly Zayko 29. July 2009 18:05

If you need to create a GUID in VS2008 but this menu is disabled then you are facing the same problem as I did. Probably some options were disabled during installation. Fortunately it is easy to fix.

Copy two files guidgen.exe and Uuidgen.Exe form
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin
to
C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools
and you don’t even need to restart your Visual Studio.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

Visual Studio Tip

Detect how many CPUs (or cores) available on a system? (C#)

by Vitaly Zayko 21. July 2009 11:30

Quite important to be prepared for the Parallel Computing.
This will show you how lucky your system is Smile:

int cpu = System.Environment.ProcessorCount;

Greetings!

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

Code Snippets

C#: How To Disable Windows Screensaver programmatically?

by Vitaly Zayko 18. May 2009 15:22

In some cases you may want to prevent Windows screensaver from running. For example, when a customer watch video or does VoIP call, his mouse and keyboard activities are low.

I didn’t find a managed function in .NET Framework but fortunately we can make it through PInvoke.

1. Add PInvoke namespace:

using System.Runtime.InteropServices;

2. Import SystemParametersInfo function and its enums as below:

public enum SPI : uint
{
   SPI_GETSCREENSAVEACTIVE = 0x0010,
   SPI_SETSCREENSAVEACTIVE = 0x0011
}
public enum SPIF : uint
{
   None = 0x00,
   SPIF_UPDATEINIFILE = 0x01,
   SPIF_SENDCHANGE = 0x02,
   SPIF_SENDWININICHANGE = 0x02
}
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, ref uint pvParam, SPIF fWinIni);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, uint pvParam, SPIF fWinIni);

3. You may want to check is screensaver enabled by Control panel setting or not:

uint vParam = 0;
if (SystemParametersInfo(SPI.SPI_GETSCREENSAVEACTIVE, 0, ref vParam, SPIF.None))
{
   if (vParam == 1)
       MessageBox.Show("Screensaver is enabled");
   else
        MessageBox.Show("Screensaver is disabled");
}
else
    MessageBox.Show("Error!");

4. And finally - disable it:

if (SystemParametersInfo(SPI.SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF.None))
{
   MessageBox.Show("Screensaver has been disabled");
}
else
    MessageBox.Show("Error!");

5. Don’t forget to re-enable if it was enabled initially:

SystemParametersInfo(SPI.SPI_SETSCREENSAVEACTIVE, 1, 0, SPIF.None);
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

Code Snippets

New version of ASP.NET AJAX Control Toolkit available!

by Vitaly Zayko 14. May 2009 12:41

Three new controls have been added:

  1. HTMLEditor - The HTMLEditor control allows you to easily create and edit HTML content. You can edit in design mode, as a rich text editor, or in source view to edit the HTML markup directly.
  2. ComboBox - The ComboBox control provides a DropDownList of items, combined with TextBox. Different modes determine the interplay between the text entry and the list of items.
  3. ColorPicker - The ColorPicker Control Extender can be attached to any ASP.NET TextBox control. It provides client-side color-picking functionality with UI in a popup control.

Download from here.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

General

Where “Send To” in Windows 7?

by Vitaly Zayko 13. May 2009 09:44

Long time ago I have found useful to add some custom shortcuts to “Send To” folder in Windows. Most useful for me is shortcut to Notepad: if you have this shortcut in “Send To”, when you need to open any text file (or HTML, or XML – you name it) you just need to select that file in Windows Explorer, right click on it and under “Send To” select the Notepad shortcut. Simply, isn’t it?

It is not always easy to locate this folder. Because Windows 7 is coming and I already switched to Win7 RC, this tip applies to Win7. Here is the path: C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\SendTo

Note: folder “AppData” is system and hidden by default, thus if you hate to type the entire path manually, open C:\Users\<user name>\ location then type “AppData” in address bar and then you can use your mouse to navigate to “SendTo”.

SendTo folder in Windows 7

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

General

How to shrink LOG files in Microsoft SQL Server 2005 and 2008

by Vitaly Zayko 10. April 2009 15:26

You know that LOG files of actively used SQL Server databases could become huge, even bigger than data (MDF) file.
In SQL2005 you can use this script to shrink LOG file size:

USE <database name>
BACKUP LOG <database name> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<log file name>, <preferred size>)

But this is no longer working in SQL2008. So do this:

USE <database name>
ALTER DATABASE <database name> SET RECOVERY SIMPLE
DBCC SHRINKFILE(<log file name>, <preferred size>)
ALTER DATABASE <database name> SET RECOVERY FULL

Good luck!

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

SQL

How to send HTML e-mail with an image embedded in its body? (C#)

by Vitaly Zayko 20. February 2009 13:56

I’m trying to cover two common questions in one post:

  1. How to send an HTML message by SMTP?
  2. How to embed a picture into its body?

Follow the C# code below.

// Use AlternateView to create HTML body ("cid:image" - here we place the image):
using(AlternateView htmlView = AlternateView.CreateAlternateViewFromString(
   "This is an <b>Html</b> e-mail message with <i>embedded image</i> below\r\n<img src='cid:image'>",
   null, "text/html"))
{
   // Create LinkedResource to specify an embedded image:
    using (LinkedResource image = new LinkedResource("c:\\IMAGE.jpg"))
   {
       // ContentId should be equals to the CID that we specified above
        image.ContentId = "image";
       htmlView.LinkedResources.Add(image);

       mail.AlternateViews.Add(htmlView);

       // Create SmtpClient as reqular:
        SmtpClient smtp = new SmtpClient("mail.zayko.net");

       // Set Credential if needed:
        smtp.Credentials = new System.Net.NetworkCredential("mailusername", "mailpassword");

       // ...and here we go:
        smtp.Send(mail);
   }
}

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

Code Snippets

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

About the author

Vitaly Zayko

Senior Software Developer / Team Lead / Product Manager

Moscow, Russia