Monthly Archives: May 2010

Error code 2869 while installing msi on windows server 2008

The windows service created using VS2005 was working fine with windows server 2000, when moved to windows server 2008 this error raised. This error was telling to have administrative privileges, even though I had administrative privileges I was getting this error. So I had to workaround.I think this happend because of UAC, even if you are granted administrator privileges you are not, you are only temporary granted administrator privileges when running programs.MSI custom actions that interact with system and require administrative privileges, will fail to run as it impersonates by default.So this error can resolved by telling custom actions not to impersonate. Have to update the CustomAction table of msi.
Added a NoImpersonate.js script to the setup,

// Usage: CustomAction_NoImpersonate.js
// Performs a post-build fixup of an MSI to change all
// deferred custom actions to include NoImpersonate
// Constant values from Windows Installer
var msiOpenDatabaseModeTransact = 1;
var msiViewModifyInsert = 1
var msiViewModifyUpdate = 2
var msiViewModifyAssign = 3
var msiViewModifyReplace = 4
var msiViewModifyDelete = 6
var msidbCustomActionTypeInScript = 0x00000400;
var msidbCustomActionTypeNoImpersonate = 0x00000800
if (WScript.Arguments.Length != 1)
{
WScript.StdErr.WriteLine(WScript.ScriptName + " file");
WScript.Quit(1);
}
var filespec = WScript.Arguments(0);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);
var sql
var view
var record
try
{
sql = "SELECT `Action`, `Type`, `Source`, `Target` FROM `CustomAction`"
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
while (record)
{
if (record.IntegerData(2) & msidbCustomActionTypeInScript)
{
record.IntegerData(2) = record.IntegerData(2) msidbCustomActionTypeNoImpersonate;
view.Modify(msiViewModifyReplace, record);
}
record = view.Fetch();
}
view.Close();
database.Commit();
}
catch(e)
{
WScript.StdErr.WriteLine(e);
WScript.Quit(1);
}

It will update all the custom action script options to include noimpersonate optionyou can take a look at the custom action script options here.Add the script to the PostBuildEvent, as
CScript.exe “$(ProjectDir)NoImpersonate.js” “$(BuiltOutputPath)”
If this thing doesn’t work you can do the same thing using WiRunSQL.vbs (Google for it..), with the parameters to update like
CSCript.exe “$(ProjectDir)WiRunSQL.vbs” “$(BuiltOutputPath)” “UPDATE CustomAction SET Type = 3585 WHERE Type =1537”
in PostBuildEvent (WiRunSQL.vbs take two parameters one msi path and sql command).

If you are getting any issues while performing builds, you can do the same thing in CommandPrompt.If nothing works, you can download ORCA.exe which comes with Windows SDK, and update the codes to include NoImpersonate in install, uninstall, rollback and commit(3073-uninstall & install, 3329 -rollback, 3585 – commit). And also add the error in the error table.
Hope this helps.

Believe in GOD

As the recession continues, the layoffs come in big from all sides. Even for me, I was working for a medium sized organization, I was worried about my job. So I concentrated more on work and working very hard, with less coffee breaks, less lunch breaks, less chit-chat. Whereas my colleagues were enjoying with more breaks and long discussions on useless subjects. They were always in good books of our managers as they were close to them and go with them for dinners. And finally a day came, lack of budget need to relieve some guys…. Managers gathered and after long discussions, I was the chosen one to leave the duties next day from my group. I was very upset, even working hard for so many months, I am being thrown out. I prayed Lord, and started applying for companies the same day.Luckily there was a opening in a big organization for my skills, and have to attend the interview early next week. I thanked Lord for showing light in such bad time and started preparing for the interview. I attended the interview, very nervous was I am. Interviewer noticed that and made me comfortable, entire interview was like a discussion, and we discussed for couple of hour. He said, he has to interview another couple of guys and will let me keep posted about the result. I prayed Lord and waiting for the result and applying for some other companies. And one fine morning, I got a call and gave me the news, I was selected.Now here I am, stable job in recession time.Thank you GOD

Connecting WebService from SQL stored procedure

When I wanted to connect a web service and perform some tasks in database at regular intervals of time, my first choice was going for windows service. That was easy and I was familiar with the process. Due to some constraints in my organization, I had to look for alternatives.I was able to access the webservice from sql clr.Steps:1. Create a wsdl class file of the webservice.using in command prompt

 wsdl http://www.test.com/WebService/Testsvc.asmx /language:vb /out:C:\TestSvc.vb 

 Include this class file in the application where you are creating a sql clr. Below is an example:
Imports Microsoft.VisualBasic
Imports System
Imports System.data
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Server
Imports System.Data.SqlTypes
Imports System.Runtime.InteropServices
Imports System.XmlPartial 

Public Class StoredProcedures_

  Public Shared Sub GetTest( ByRef value1 As SqlInt32, ByRef value2 As SqlString)
    Dim Connection As New SqlConnection("Context Connection = true")
    Dim iWeb As New com.WSMainTestDim result as Integer = iWeb.GetAdditionTest(value1, value2)Connection.Open()
    Dim insert As String = "Insert into tblResponse (Text) Values ('" + result + "')"
    Dim command1 As New SqlCommand(insert, Connection)
    command1.ExecuteNonQuery()
    Connection.Close()
    Connection.Dispose()
  End Sub
End Class3.

Once I created the clr built the application and turned this class into a dll and also web service is also created as dll. create sgen for webservice.4.Add all 3 dlls to the database on which you wanted to attach the sql and access the webservice. Get to the database, in the assembly folder add these 3 dlls. The main clr file which connects to dll need to have external access permission set.5.Once you add these 3 dlls to the assembly folder, create procedure for the stored procedure clr.

Create PROC [Stored Procedure definition]([Parameters])
   With EXECUTE AS CALLERASEXTERNAL NAME (dll name of the stored procedure).     (class name).(method name)

For my purpose I created a job to perform certain tasks at regular intervals of time.Hope this could help someone.Thanks,Kishore Patil

Windows Azure

Nowadays we are hearing a lot about cloud computing. Cloud computing is like providing softwares, infrastructure as a service. To manage data on the diversified datacenters, microsoft has introduced Windows Azure. It is an operating system to manage applications, data on the microsoft datacenters with no worry about infrastructure. One can create applications in their own language (.net, php or windows native code ) using visual studio or even eclipse.
It allows the developer to perform
Development. An environment for developers based on familiar concepts and frameworks. Computation. A virtualized service execution environment running on cloud-based hardware. Management. A policy-based infrastructure for controlling the way services operate. Storage. A scalable set of cloud storage services for data.
Its important to note that there is no big difference to a developer between the local environment and cloud based environment.
The user can manage web roles on Azure with IIS, and can manage load balancing on the web site. SQL Azure as a storage service, user can store data as Blobs for large items of data, tables and queues to manage data.
AppFabric allows the user to connect to loosely coupled applications securely.

Development in Android

Android is a mobile phone operating system initially developed by Android Inc, later purchased by Google. Anyone can download the SDK (software development kit) and write applications for Android phones. One can download the sdk at http.developer.android.com/sdk/. The sdk will allow you to develop, test, profile and debug using the emulator and other included tools.

The Android SDK provides tools and APIs to begin developing

Google doesn’t screen developers or applications. Google doesn’t even take part of the profits.

Google formed a group of hardware, software, and telecommunication companies called the Open Handset Alliance with the goal of contributing to Android development.

To develop usind Android SDK, as per the Android guide, its much easier to develop apps using eclipse. The basic requirements to develop using android are, download latest version of Android SDK and install it, download latest version of JDK (only JRE is not enough) and latest version of eclipse IDE for Java developers. Once you installed ecplipse, install the Android Development Toolkit (ADT). For eclipse galileo, start eclipse go to Help -> install new software and
In the Available Software dialog, click Add….
In the Add Site dialog that appears, enter a name for the remote site (for example, “Android Plugin”) in the “Name” field.
In the “Location” field, enter this URL:https://dl-ssl.google.com/android/eclipse/
Note: If you have trouble acquiring the plugin, you can try using “http” in the URL, instead of “https” (https is preferred for security reasons).
Click OK.
Back in the Available Software view, you should now see “Developer Tools” added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next.
In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish.
Restart Eclipse