Thursday 22 September 2016

The 'microsoft.ace.oledb.12.0' provider is not registered on the local machine - Resolved

        In this post we are going to see the interesting issue like "The microsoft.ace.oledb.12.0" provider is not registered on the local machine , first let we understand why this issues are raising, then we go step by step process how to resolve this.

While working with the Microsoft Access Database , we may receive error like following






Why this error is raising , There are number of reasons why we get this error, when trying to connect access or xlsx file, The ACE provider is not installed on operating systems by default., so how we can resolve this error, we have to many steps , anything solution can resolve your issues. because by default this settings needed by application.




For web applications first we have to do the following steps.

Solution 1:

1. Open the run window , Type inetmgr and press Enter
2. Now IIS will be there, Next select the application pool, under which your application is running

















3. Go to the Advance settings, enable 32-bit application "True"







For Visual studio projects, we have to change the build

Solution 2:

1. Open your project in visual studio
2. Right click on the solution in solution explorer




3. Click on the Configuration manager 
4. Click on the Active Platform Drop down, if x86 is already there then select that, else click on New.





5. Select x86 as new target platform


6. Compile the Project




For Windows Applications
Solution 3:
you can do this settings in project level also,  by setting the target platform as X86 by using the following steps  
Select the project =>properties => Debug => Platform Target=> X86
(or)
Select the Project => Properties => Build => Platform Target => X86






Solution 4:

Step 1:
If above step doesn't work for you ,then  try below steps
Try to connect the access database from visual studio , if you get error then install the following thing



Step 2:
If above step doesn't work for you ,then  try below steps,

 Note: It will work for Office 2010, even though it is 2007 



Step 3:
Again if you have issues , try below steps
Install the following Office system drivers from following link


Step 4:


Install MS Office in the system



From the above steps you can  learn how to resolve the isssue "Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine"


Wednesday 21 September 2016

Log4Net is not logging the file, randomly stops resolved

In this post we are going to see some important things in the Log4Net logging utility, normally Log4Net is using for logging the data in application, sometimes you may notice that the logging stops randomly, you know why it is happening, surely not, it stops with out any information for that kind of scenario, how we can find the root of the issue, Let me guide you how to do that 



<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="log4net.Internal.Debug" value="true"/>
    </appSettings>
</configuration>


From the above you may notice that we are adding one new key in the app setting which makes the Log4Net to run in Debug mode, this makes to write everything happening behind the scene to do that we have to configure the path to write the debug info.so use the below code snippet configuration



<configuration>
    ...
    <system.diagnostics>
        <trace autoflush="true">
            <listeners>
                <add 
                    name="textWriterTraceListener" 
                    type="System.Diagnostics.TextWriterTraceListener" 
                    initializeData="D:\logging\log4net.txt" />
            </listeners>
        </trace>
    </system.diagnostics>
    ...
</configuration>


From the above configuration we are writing the debug information in the location, please make sure that the path must be in write permissions

For web applications find the account under which it is running may be IIS_IUSRS, IIS_WPG, or under specific account,then now go to the folder path where you are writing log, do the following steps to give permission.


1. Select the folder, right click and click on properties
2. Select the security tab
3. Click on Edit , under users or group
4. Click Add on security
5. click Advance button
6. Click Find Now






\
















Now you will get a list of users find the users like IIS_IUSR, or IIS_WPG or specific account under you run ur application, and give OK. thats it



Sample configuration file for Log4Net with out Debug:


<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />

<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
  <file value="C:\\log\\TLog.txt" />
  <appendToFile value="true" />
  <rollingStyle value="Size" />
  <maxSizeRollBackups value="10" />
  <maximumFileSize value="10MB" />
  <staticLogFileName value="true" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
  </layout>
</appender>

<root>
  <level value="DEBUG" />
  <appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>




After done this we have to load the information on startup or in load of application

protected void Application_Start(Object sender, EventArgs e) {
   log4net.Config.XmlConfigurator.Configure();
}



From this post you can learn how to debug the Log4Net loggig issue when it randomly stops.


Monday 19 September 2016

Convert multiple Video files at a same time to various formats like MPG and Mp3 using Batch and add it to sendTo options in Windows 10

Now In this post we are going to see how to convert the video file to MPG and Mp3 using batch file with simple steps like using SendTo options, for this first we need to install the VLC player, then we have to do the following steps.

Checklist : VLC player needs to be installed








Next : we are going to create a two batch scripts , one for Convert to MPG, another one for Convert to Mp3, so at the end we are going to have a screen like below , to quick access from sendTo options.


From the above screen , now we know that when we right click the file we have options like convert to in sendTo, so for achieve that we have to create two script file , 

Screenshot:









1. Copy the below code and save it as "Convert To Mp3.bat" file in desktop,  
2. Type  "shell:sendto" in run window, it will open the shell window, 
3. Copy the "convert To Mp3.bat" file to shell window like below




@ECHO OFF
rem ***********************************************************************
rem * Convert to Mp3 batch converter.                                     *
rem *                                                                     *
rem * For installation just copy batch file to SendTo directory.          *
rem * Type "SHELL:sendto" in Run     to go to Sendto folder.              *
rem *                                                                     *
rem * I got quite good compression rations with these parameters:         *
rem * vcodec=none      codec used                                         *
rem * vb=10000         video bandwidth                                    *
rem * deinterlace=1    rebuild full pictures from keyframes and diffs.    *
rem * acodec=mp3       audio codec                                        *
rem * ab=128           128kbps mp3 quality                                *
rem * channels=2       stereo                                             *
rem *                                                                     *
rem ***********************************************************************
echo **********************************************************************
echo Convert to MP3 VLC batch converter called: %0 %1 %2 %3 %4 %5 %6 %7 %8
echo **********************************************************************
echo.
echo.

SET _new_extention=mp3

:start
if "%~1"=="" (call goto :the_end)
CALL :SUB_CONVERT %1
SHIFT
goto :start


:SUB_CONVERT
SET _orig_path=%~1
rem SET _orig_extention=%_orig_filename:*.=%
echo %_orig_path%
SET _orig_extention=%_orig_path:*.=%
CALL SET _new_path=%%_orig_path%:.%_orig_extention%=.%_new_extention%%%
set _new_path="%_new_path%"
echo.
echo Converting %1 ======TO===== %_new_path% ...
echo.

if exist "%ProgramFiles%\VideoLAN\VLC\vlc.exe" (
SET _vlc_path="%ProgramFiles%\VideoLAN\VLC\vlc"
) else (
SET _vlc_path="%ProgramFiles(x86)%\VideoLAN\VLC\vlc"
)

CALL %_vlc_path% -I dummy -vvv %1 --sout=#transcode{vcodec=none,acodec=mp3,
ab=128,channels=2,samplerate=44100}:standard{access=file,mux=mp3,
dst=%_new_path%} vlc://quit
GOTO :eof

:the_end
echo **********************************************************************
echo * FINISHED                                                           *
echo **********************************************************************


pause





2.  Type  "shell:sendto" in run window





3.  copy the "convert To Mp3.bat" file to shell window 












1. Copy the below code and save it as "Convert To MPG.bat" file in desktop, 
2. Type  "shell:sendto" in run window, it will open the shell window, 
3. Copy the "convert To MPG.bat" file to shell window like below




@ECHO OFF
rem ***********************************************************************
rem * Convert to MPG batch converter. (2014-09-29 Sinx)                   *
rem *                                                                     *
rem * For installation just copy batch file to SendTo directory.          *
rem * On Win8 execute "SHELL:sendto" to go to Sendto folder.              *
rem *                                                                     *
rem * I got quite good compression rations with these parameters:         *
rem * vcodec=h264      codec used                                         *
rem * vb=10000         video bandwidth                                    *
rem * deinterlace=1    rebuild full pictures from keyframes and diffs.    *
rem * acodec=mp3       audio codec                                        *
rem * ab=128           128kbps mp3 quality                                *
rem * channels=2       stereo                                             *
rem *                                                                     *
rem ***********************************************************************
echo **********************************************************************
echo MOV to MPG VLC batch converter called: %0 %1 %2 %3 %4 %5 %6 %7 %8
echo **********************************************************************
echo.
echo For installation, just copy batch file to SendTo folder..
echo.

SET _new_extention=mpg

:start
if "%~1"=="" (call goto :the_end)
CALL :SUB_CONVERT %1
SHIFT
goto :start


:SUB_CONVERT
SET _orig_path=%~1
rem SET _orig_extention=%_orig_filename:*.=%
echo %_orig_path%
SET _orig_extention=%_orig_path:*.=%
CALL SET _new_path=%%_orig_path%:.%_orig_extention%=.%_new_extention%%%
set _new_path="%_new_path%"
echo.
echo Converting %1 ======TO===== %_new_path% ...
echo.

if exist "%ProgramFiles%\VideoLAN\VLC\vlc.exe" (
SET _vlc_path="%ProgramFiles%\VideoLAN\VLC\vlc"
) else (
SET _vlc_path="%ProgramFiles(x86)%\VideoLAN\VLC\vlc"
)

CALL %_vlc_path% -I dummy -vvv %1 --sout=#transcode{vcodec=h264,vb=10000,deinterlace=1,
acodec=mp3,ab=128,channels=2,samplerate=44100}:standard{
access=file,mux=ts,dst=%_new_path%} vlc://quit
GOTO :eof

:the_end
echo **********************************************************************
echo * FINISHED                                                           *
echo **********************************************************************

pause




2.  Type  "shell:sendto" in run window





3. copy the "convert To MPG.bat" file to shell window               









After copying the batch file in the sendto, now you can right click the video files, and go to the 
SendTo options , you can see various options Convert To Mp3, Convert To MPG 












Now you can see the converted file in the same location , where to click the sendTo options, for Convert To Mp3 or Convert To MPG

From this post you can able to learn how to create a tool to convert multiple video files at a same time to various formats like MPG and MP3 using batch file