آبان ۲۳، ۱۳۹۰

Fix error "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance."


"Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."

If you did and tried to find how to resolve this you probably Googled (or Binged) for hours without being able to find the solution that really works.

Well lets put an end to that. Two simple things need to be done:

Step 1. Enabling User Instances on your SQL Server installation
First we are gonna make sure we have enabled User Instances for SQL Server installation.

Go to Query Window in SQL Server Management Studio and type this:

exec sp_configure 'user instances enabled', 1.
Go
Reconfigure



Run this query and then restart the SQL Server.

Step 2. Deleting old files
Now we need to delete any old User Instances.
Go to your C drive and find and completely DELETE this path (and all files inside):

C:\Documents and Settings\YOUR_USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

(Dont forget to replace the green text in the path with your current username (if you are not sure just go to C:\Documents and Settings\ path to figure it out).

Step 3.

  • Run the Internet Information Services (IIS) Manager tool.  This tool can be accessed either from the Administrative start menu, or by typing "inetmgr" in the Windows Start-->Search textbox and selecting the inetmgr tool.
  • In the left-hand pane of the IIS Manager tool expand the machine node.
  • Click on the "Application Pools" node so that the application pools display in the main window of the management tool.
  • If you are troubleshooting an ASP.NET 2.0/3.0/3.5 application select the "DefaultAppPool" application pool.  For ASP.NET v4 select the "ASP.NET v4.0" application pool.
  • Right-click on the selected application pool and choose "Advanced Settings"
  • In the "Advanced Settings" dialog box find the category called "Process Model".  The first row in the category will be the "Identity" row.
  • Click on the "Identity" row and then click on the small button that shows on the right-hand side of the value cell.  The button displays the text "…"
  • A dialog box called "Application Pool Identity" will popup.  Within that dialog box there are two radio buttons.  Make sure the first radio button titled "Built-in Account" is selected.
  • In the dropdown box below the radio button choose "Network Service" for the identity.
  • Click "Ok" to close out the "Application Pool Identity" dialog box.
  • Click "Ok" to close out the "Advanced Settings" dialog box.
  • At this point the changes to the application pool identity will have been saved to IIS 7.5's configuration store.

آبان ۱۱، ۱۳۹۰

Installing OpenCV 2.3.0 in Windows with VisualStudio 2010


Download OpenCV source: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3/OpenCV-2.3.0-win-superpack.exe/download
Extract “opencv” folder  to fiels to C:\cv
Download and install CMake
Start the CMake GUI from Start menu
Select:
•Where is the source code: (the directory where CMakeLists.txt in OpenCV is stored), eg: "C:\Program Files\OpenCV2.2"
•Where to build the binaries: (the directory where the OpenCV library will be built), eg: "C:\Program Files\OpenCV2.2\build"
•Add these two entries:
     oUSE_FFMPEG with value 1
     oWITH_CUDA with value 0

Press Configure and select Visual Studio 2008 or 2010 project.
Enter any parameters, like if you want to build Python bindings, documentation, shared libraries, use TBB, CUDA, Eigen2 libraries, etc. (Note that TBB, 64-bit and CUDA may still be under development and therefore buggy)
Repeat pressing Configure until no more red rows are highlighted.
When ready, press Generate.
Open the "build" directory, where you will find your VS2008 or VS2010 "sln" file.
Open the sln file in VS2008 or VS2010, and Built the Solution. This should compile the OpenCV 2.2 library into the build folder.

WALK THROUGH FOLDERS YOU SHOULD INCLUDE IN VS AND REPLACE THEIR FILES WITH CURRENT BUILT FILES.

Building your own projects using OpenCV 2.2 in Visual Studio

After you have compiled the OpenCV 2.2 library using CMake, you should configure your Visual Studio projects to use OpenCV.
For the below instructions its assume that you installed OpenCV to the default location C:\OpenCV2.2 - if you selected something different (e.g. C:\Program Files\OpenCV2.2) then please adjust accordingly.
First of all create your new (full or empty) C/C++ project.
For an application project (*.exe) add this to your project properties:
Go to VC++ Directories
Add 2 new Include Directories (it's the path where you installed OpenCV, include folder):
C:\Program Files\OpenCV2.2\include
C:\Program Files\OpenCV2.2\include\opencv
Add 1 new Library Directory (it's the path where you installed OpenCV, lib folder):
C:\Program Files\OpenCV2.2\lib
Go to Linker in the left menu and select Input option
Add these entries on Additional Dependencies option:
C:\Program Files\OpenCV2.2\lib\opencv_core220d.lib
C:\Program Files\OpenCV2.2\lib\opencv_highgui220d.lib
C:\Program Files\OpenCV2.2\lib\opencv_video220d.lib
C:\Program Files\OpenCV2.2\lib\opencv_ml220d.lib
C:\Program Files\OpenCV2.2\lib\opencv_legacy220d.lib
C:\Program Files\OpenCV2.2\lib\opencv_imgproc220d.lib
Make the content of 'OpenCV_Helloworld.cpp' as such:

For a shared dynamically loadable library project (DLLs) add this to your project properties:
C/C++ - General - Additional include Directories:
C:\OpenCV2.2\include\opencv;C:\OpenCV2.2\include
Linker - General - Additional library Directories:
C:\OpenCV2.2\lib
Linker - Input - Additonal Dependencies (debug):
opencv_core220d.lib opencv_highgui220d.lib opencv_video220d.lib opencv_ml220d.lib opencv_legacy220d.lib opencv_imgproc220d.lib
Linker - Input - Additonal Dependencies (release):
opencv_core220.lib opencv_highgui220.lib opencv_video220.lib opencv_ml220.lib opencv_legacy220.lib opencv_imgproc220.lib

// OpenCV_Helloworld.cpp : Defines the entry point for the console application.
// Created for build/install tutorial, Microsoft Visual Studio and OpenCV 2.2.0

#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

int _tmain(int argc, _TCHAR* argv[])
{
        // Open the file.
        IplImage *img = cvLoadImage("photo.jpg");
        if (!img) {
                printf("Error: Couldn't open the image file.\n");
                return 1;
        }
        // Display the image.
        cvNamedWindow("Image:", CV_WINDOW_AUTOSIZE);
        cvShowImage("Image:", img);
        // Wait for the user to press a key in the GUI window.
        cvWaitKey(0);
        // Free the resources.
        cvDestroyWindow("Image:");
        cvReleaseImage(&img);

        return 0;
}



Click on "Debug -> Build Solution" or "Release -> Build Solution" to compile your project. If there was a compile error then you did not set the header file includes correctly. If there was a linker error then you did not set the library path or lib files correctly.
If you get the message as ' 'msvcv100d.dll' ' or ' 'msvcr100d.dll' ' cannot be loaded then download these two dlls(search on google) and copy them to 'bin' folder.
Copy any JPG image as 'photo.jpg' to 'My Documents\Visual Studio 2010\Projects\OpenCV_Helloworld\OpenCV_Helloworld', or to wherever you saved the project to.
Click on "Debug -> Start Debugging" or "Debug -> Start without Debugger".
You should now see an OpenCV GUI window with the photo inside. If an error window pops up about DLL files then make sure you compiled the OpenCV library using CMake (above) and have the OpenCV DLL files on your system PATH or in the same folder as the EXE of your project. If the program runs but it says it cant find the image file, then make sure your image is in the same folder as the EXE, and that it is named 'photo.jpg'.

REF:
http://opencv.willowgarage.com/wiki/VisualC%2B%2B
http://opencv.willowgarage.com/wiki/InstallGuide

OpenCV 2.3.0 Binary for Windows (with ffmpeg support) : http://www.mediafire.com/?cxqtzea2uxd1cfk