


An occasional series of development hints and tips we found useful and share with the world.
It took ages to debug this issue for a client, so we'll post our answer here in case others find it useful.
A Windows 7 PC exhibited stuttering audio suddenly every few minutes, when it had been working correctly for months. The Device Manager was repainting itself, each repainting coinciding with stuttering sound.
The issue was tracked down to Windows Defender, which had switched itself on following an automatic update; switching it off (the client is behind a solid firewall, so it isn't necessary to run defender) via Control Panel / Windows Defender / Tools / Options /Administrator / Use this Program resolved the issue.
If you see this in your Visual Studio .Net application on a freshly installed Windows Server 2003 box in particular, the fix is really quite obscure and completely unrelated to the error message.
Go to "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files", and access the security tab for the folder. Grant 'Full Control' to the users group, or whichever user .net is running under.
Now reload the page in your browser. Amazing, eh?
If you have a problem with dates being corrupted on being passed from one server to another via an ASP.net webservice in vb.net (visual studio 2003, but also happens in visual studio 2005), read on.
Sometimes the dates flip format - 2/6/2008 becomes 6/2/2008; 13/6/2008 is dropped altogether because it becomes an illegal date.
To resolve, change the globalization setting in the web.config on each server to this: (originally there was no culture= en-GB argument).
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-GB" />
We're building a complex Microsoft Access 2003 front end application for one of our clients, and wanted it to paint the form nice and quickly. Quite hard when you have multiple pages on the form, switching on and off depending on the data.
The following routines call the Windows API and help by switching off repainting on a form, and switching in back on again once we're done, refreshing the screen to paint all the form nicely. Pass in the form object you want to suspend/restart screen painting on (usually by passing Me from a routine in the form itself).
Note that this needs to be placed in a separate module, not in the form code.
Private Const WM_SETREDRAW = &HB
Private Const RDW_ALLCHILDREN = &H80
Private Const RDW_UPDATENOW = &H100
Private Const RDW_ERASE = &H4
Private Const RDW_INVALIDATE = &H1
'Private Const HWND_BROADCAST = &HFFFF&
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Private Declare Function RedrawWindow Lib "user32" (ByVal hWnd As Long, ByVal lprcUpdate As Long, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Public Sub WindowsRepaintOff(m)
SendMessage m.hWnd, WM_SETREDRAW, False, 0&
End Sub
Public Sub WindowsRepaintOn(m)
SendMessage m.hWnd, WM_SETREDRAW, True, 0&
RedrawWindow m.hWnd, 0, 0, RDW_INVALIDATE + RDW_ALLCHILDREN
End Sub
We've recently noticed that our online backups provided by the wonderful people at www.mozy.com are uploading data slower than they should. There are reports of anti-virus software interfering with Mozy, and making it slower than it should be, but our anti-virus, AVG, doesn't seem to cause a problem at all. Switch it off, and upload speed remains resolutely at 300Kb/s.
So, it's time to talk about Data Execution Prevention. A new technology in Windows XP, designed to limit the impact of buffer overruns caused by errors in programs and virus exploits. How effective is it? Not very, to be honest. It does have the unfortunate side effect of slowing certain programs down though. So try the following:
Click on My Computer, then View System Information (off to the left). On the Advanced tab, click on Settings under Performance, then on the Data Execution Prevention tab. If you have 'Turn on DEP for all programs and services except those I select' ticked, use the Add dialog to add each of the executables in the Mozy Program files directory - mozybackup.exe, etc. Press OK to save, and reboot your server.
Now, assuming your upload speed on your internet connection is quick enough, you should find Mozy's uploads are up to 1Mb/s.