Today I came across a problem with Visual Studio 2008 installation program. The following error occurred when I tried to add/remove Visual Studio components via control panel:
A selected drive is no longer valid

This error occurs after installation of Visual Studio 2008 SP1 (Service Pack 1), so you can no longer add or remove components of the install.

In order to fix this error, you have two choices:

1. Uninstall SP1 via control panel, add necessary components to non-SP install, then apply SP1 again.

2. Locate and install required component manually. I was looking to add SQL Server Express Edition to my install. I found it at “\WCU\SSE\SQLEXPR.EXE” in Visual Studio 2008 installation folder (unpacked .ISO). This should work for other components accordingly.

{ 0 comments }

PHP AjaXplorer: limit upload by file extension

by admin on November 10, 2009

I had to add file management capability to one of my projects and encountered a serious issue. AjaXplorer FAQ says the following:

How can I filter some file extensions, both for display/download and for upload?

For the upload part, it’s not done via configuration, but you can easily hack one file to suit your needs. Open the file client/html/flash_tpl.html at line 8 :
You can see :
>> $FlashVar = ‘&fileTypes=*.*&fileTypeDescription=All%20files&totalUploadSize=’.$confTotalSize.’ [.... end of line]

You can edit the « fileTypes » and « fileTypeDescription » variable using for instance the following syntax :

>> [...]&fileTypes=*.doc;*.jpg;*.gif&fileTypeDescription=My%20Type%20Description&[...]

However, the above method in not secure.

In AjaXplorer customization, if you need to *really* filter out files based on file extension, you have to customize the storage plugin. In my case “access.fs”, class.fsAccessDriver.php script. I wrote the following code to accomplish this task:

 
if($fancyLoader) $userfile_name = SystemTextEncoding::fromUTF8($userfile_name);
 
//Filtering code here
if ( !preg_match('/.*.(avi|flv|mpeg|mpg|wmv|divx)$/i', $userfile_name, $matches) )
 
 
 
{
$errorMessage="You can upload video files only";
break;
 
 
}

This code will filter files on the server side and generate pop-up error if extension is not permitted. Furthermore, it works with non-flash uploader.

{ 2 comments }

Speed up your Visual Studio 2008!

November 10, 2009

5 simple steps to improve speed of your old VS 2008 bro

Install Visual Studio 2008 Service Pack 1. Download it here: http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en
Remove unnecessary imported namespaces via “Project Properties”, “References tab”. Such imports significantly slow down the IDE.
Change your project compilation to x86 only, if you don’t need x64. This will improve compilation speed. “Project Properties”, [...]

Read the full article →

Group Properties into Categories

November 10, 2009

If you want to group your class / component / control properties into categories, such as Accessibility, Appearance, Behavior, Data, Design, etc., it’s very easy to accomplish. All you need is to put System.ComponentModel.Category attribute on top of a property:

View Code VBNET 
<Category("CoolCategory")> _
Private categorizedPropertyValue As String
[...]

Read the full article →

Use WIA to retrieve images from scanner, digital camera or webcam using VB.NET and C#.

September 19, 2009

Get images from scanner, webcam or any other type of imaging device
Here’s the class that I wrote to extract images from various imaging devices via VB.NET and C#.
WIA (Windows Image Acquisition) supports the following types of devices:

Scanners
Digital Cameras
Webcams

The class correctly communicates with Windows Image Acquisition Library (WIALib), releases all COM objects used and allows you [...]

Read the full article →

Strict VB.NET

September 17, 2009

Sometimes VB.NET is considered less powerful than C#. This isn’t true, all .NET languages have equal abilities.
The only difference is that VB.NET allows too many liberties in default configuration.
Old VB Compatibility Namespace
The first unnecessary thing consists of imported Visual Basic 6 Compatibility Namespace (Microsoft.VisualBasic). If you wish to become a true .NET programmer, you have [...]

Read the full article →

Open a specific key in regedit

September 12, 2009

Regedit Open Key
Unfortunately, there’s no command-line switch to open a specific key in Windows Registry Editor. However, the task can be achieved via LastKeyvalue of Applets key. If you need to open a hive in regedit, you can use C# and VB.NET code located below.
Regedit Open Hive

View Code CSHARPusing Microsoft.Win32.Registry;
using Microsoft.Win32;
using System.IO;
 
public class RegEditKeyOpener
{
 
public void [...]

Read the full article →

How to override .NET two connections per-server limit

September 11, 2009

There’s a secret - entire .NET application connectivity is limited to 2 connections per server by default. This is a good thing to protect servers from overloading and to encourage developer consciousness, but every benefit can have a dark side as well. If you need to override this limit for some reason, you can use [...]

Read the full article →

.NET Registry Tutorial

September 11, 2009

Let’s learn how to work with .NET Registry Classes in several simple steps.
Preparation
Let’s prepare nice environment for our registry work. Open your copy of Visual Studio 2008 and create new console application.
Registry namespace import
Open your application’s code. Add “using Microsoft.Win32;” and “using Microsoft.Win32.Registry;” to the top. If you’re in VB, add Imports Microsoft.Win32.Registry and [...]

Read the full article →

5 Common .NET Mistakes

September 11, 2009

This time I’m going to name 5 most common reasons of errors in .NET programming.
This is something that experienced programmer should avoid.  Let’s proceed.
Incorrect multithreading
Most of developers want to enhance their applications with multithreading capabilities. For some projects such enhancements are beneficial, however, they might be a burden for others. Furthermore, poorly written multi-threading code [...]

Read the full article →