Better compile times in Visual Studio
EDIT: Tried some of these today. Results are in blue.
Where I'm working now, we have a huge Visual Studio solution with hundreds of project files. The problem with this being that compile times are drastically reduced, causing great irritation and generally just hampering production.
Having a look around the web other people are definitely having this problem. Some suggestions are:
- Merge all the projects into one, or at very least merge any projects that can logically be merged. For example, unit test projects could really benefit from being merged.
- Have all projects output their bits to one directory.
- Disable anti-virus (only for the solution directory): Not much of a change. Maybe lost a few seconds build time, though results may vary. Would recommend doing this always just in case your virus checker is slowing things down.
- Combine the project files (this is generally not a great approach because the projects are split up like this so that our concerns are kept seperated).
- Creating new solutions which only contain smaller parts of the code base, and linking them to compiled dlls from the other projects (DLL hell).
- Parallel builds (Tools/Options./Projects and Solutions/Build and Run/Maximum Number of Parallel Project Builds): No noticeable change. The default setting was 4 by the way.
- Stop using TFS (purely unwarranted, but who knows? Thought I'd just throw that in there).
- Disable indexing on your source folders (windows search). No noticeable change. Didn't really expect anything to change here, because windows search has a way of delaying indexing as far as I know.
I'm going to have a look at these items tomorrow during lunch, and will update if I find anything good!
We’re sorry, this video is no longer available (FIX)
UPDATE: It seems I'm just clogging up Google search results with more useless information. The real fix is here, and it only works in South Africa!
If you're getting this error for most videos in YouTube, I've found that simply changing your location to United States allows you to view them.
Login to YouTube and click Account / Location Info.
UPDATE: If this stops working try adding &fmt=18 to the url.
Smallest XP Virtual Machine?
I've been getting a little XP VM set up for web dev, so I can test multiple sites on different browsers. Also, I wanted to put it on a flash drive. I'm using Microsoft Virtual PC 2007.
Before you do anything, if you want a really small install, I would suggest using nLite. nLite takes an original xp cd, and allows you to remove unwanted stuff from it. You get an iso which you can capture in Virtual PC. You can easily save a couple hundred mb here.
1. Install any applications you may need. (For this setup I have installed IE6, IE7, Safara, Opera and Firefox)
2. Remove unneeded applications. Also, remove everything you don't need from windows.
3. Run nCleaner, and remove pretty much everything you can.
TIP: Try run CCleaner first. I don't know how much of a difference this will make though, because nCleaner removed +100mb after CCleaner was run.
4. Compress the entire drive using NTFS compression. (Right click system drive, then properties, then check "Compress drive to save disk space".
5. Get this free disk defragger, which performs a far more aggressive defrag than other options. After installing it, run it in a command prompt like this:
defrag.exe -d c: -B
6. Run the Precompactor (capture "C:\Program Files (x86)\Microsoft Virtual PC\Virtual Machine Additions\Virtual Disk Precompactor.iso", then navigate to My Computer and double click the cd drive to run it).
7. Compact the drive using Virtual PC's Virtual Disk Wizard.
And we're done. I've got a 618mb Virtual Machine which fits perfectly on a flash drive.
Anyone know of something like TrueCrypt, but just for compression, so I can compress the system drive?
One other thing, if you need even more compression, try using 7Zip on the virtual disk!
NOTE: Some more information can be found here:
Draw RTF Text on a Graphics Object in C#
With this code you can draw some RTF text on a Graphics object.
Code modified from this code: How to print the content of a RichTextBox control by using Visual C# .NET or Visual C# 2005
Also, the control transparency code was taken from here:Simple Vector Shapes (Tried to get his code working, but there were some problems, also some of the code is in a different language)
Anyway, it's an extension method, so you can do this in a Form:
protected override void OnPaint(PaintEventArgs e) { e.Graphics.Clear(Color.Fuchsia); e.Graphics.DrawRtfText(this.richTextBox1.Rtf, this.richTextBox1.ClientRectangle); base.OnPaint(e); }
Here's the full code listing; just add a new .cs and throw it in:
using System; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; public static class Graphics_DrawRtfText { private static RichTextBoxDrawer rtfDrawer; public static void DrawRtfText(this Graphics graphics, string rtf, Rectangle layoutArea) { if (Graphics_DrawRtfText.rtfDrawer == null) { Graphics_DrawRtfText.rtfDrawer = new RichTextBoxDrawer(); } Graphics_DrawRtfText.rtfDrawer.Rtf = rtf; Graphics_DrawRtfText.rtfDrawer.Draw(graphics, layoutArea); } private class RichTextBoxDrawer : RichTextBox { //Code converted from code found here: http://support.microsoft.com/kb/812425/en-us //Convert the unit used by the .NET framework (1/100 inch) //and the unit used by Win32 API calls (twips 1/1440 inch) private const double anInch = 14.4; protected override CreateParams CreateParams { get { CreateParams createParams = base.CreateParams; if (SafeNativeMethods.LoadLibrary("msftedit.dll") != IntPtr.Zero) { createParams.ExStyle |= SafeNativeMethods.WS_EX_TRANSPARENT; // transparent createParams.ClassName = "RICHEDIT50W"; } return createParams; } } public void Draw(Graphics graphics, Rectangle layoutArea) { //Calculate the area to render. SafeNativeMethods.RECT rectLayoutArea; rectLayoutArea.Top = (int)(layoutArea.Top * anInch); rectLayoutArea.Bottom = (int)(layoutArea.Bottom * anInch); rectLayoutArea.Left = (int)(layoutArea.Left * anInch); rectLayoutArea.Right = (int)(layoutArea.Right * anInch); IntPtr hdc = graphics.GetHdc(); SafeNativeMethods.FORMATRANGE fmtRange; fmtRange.chrg.cpMax = -1; //Indicate character from to character to fmtRange.chrg.cpMin = 0; fmtRange.hdc = hdc; //Use the same DC for measuring and rendering fmtRange.hdcTarget = hdc; //Point at printer hDC fmtRange.rc = rectLayoutArea; //Indicate the area on page to print fmtRange.rcPage = rectLayoutArea; //Indicate size of page IntPtr wParam = IntPtr.Zero; wParam = new IntPtr(1); //Get the pointer to the FORMATRANGE structure in memory IntPtr lParam = IntPtr.Zero; lParam = Marshal.AllocCoTaskMem(Marshal.SizeOf(fmtRange)); Marshal.StructureToPtr(fmtRange, lParam, false); SafeNativeMethods.SendMessage(this.Handle, SafeNativeMethods.EM_FORMATRANGE, wParam, lParam); //Free the block of memory allocated Marshal.FreeCoTaskMem(lParam); //Release the device context handle obtained by a previous call graphics.ReleaseHdc(hdc); } #region SafeNativeMethods private static class SafeNativeMethods { [DllImport("USER32.dll")] public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern IntPtr LoadLibrary(string lpFileName); [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left; public int Top; public int Right; public int Bottom; } [StructLayout(LayoutKind.Sequential)] public struct CHARRANGE { public int cpMin; //First character of range (0 for start of doc) public int cpMax; //Last character of range (-1 for end of doc) } [StructLayout(LayoutKind.Sequential)] public struct FORMATRANGE { public IntPtr hdc; //Actual DC to draw on public IntPtr hdcTarget; //Target DC for determining text formatting public RECT rc; //Region of the DC to draw to (in twips) public RECT rcPage; //Region of the whole DC (page size) (in twips) public CHARRANGE chrg; //Range of text to draw (see earlier declaration) } public const int WM_USER = 0x0400; public const int EM_FORMATRANGE = WM_USER + 57; public const int WS_EX_TRANSPARENT = 0x20; } #endregion } }
You might want to do some testing, it's not exactly production code!
Problems with the Visual Studio 2008 ISO?
Visual Studio 2008 Express Editions are out!
You may have tried to mount the iso in a cd emulator which doesn't support UDF and found a README.TXT file saying:
This disc contains a "UDF" file system and requires an operating system
that supports the ISO-13346 "UDF" file system specification.
To get this working download the Microsoft Virtual CD-ROM Control Package, and follow what it says in the readme.
You should now have the disc mounted properly.
EDIT: The new Daemon Tools mounts it perfectly. I'm a moron. (Although the MS product doesn't require a reboot and is the easiest option if you don't have Dtools installed)
Gmail Tip: Mute a conversation
A feature I never even knew existed showed itself to me today.
If you're part of a mailing list, and you sometimes receive threads you don't want to take part in, you can simply press M to mute the thread. The thread will get archived, but won't show up in the inbox every time there's a new reply!
You need to have Settings / General / Keyboard Shortcuts On checked.
Gmail Tip: Mute a conversation
A feature I never even knew existed showed itself to me today.
If you're part of a mailing list, and you sometimes receive threads you don't want to take part in, you can simply press M to mute the thread. The thread will get archived, but won't show up in the inbox every time there's a new reply!
You need to have Settings / General / Keyboard Shortcuts On checked.