Wednesday, July 14, 2010

SVN CHANGE FINDER

Everyone knows how cool of a software svn is.Along with tools like visualsvn, tortoisesvn,ankh svn,svn monitor it makes you feel happy all day as with out being worried about your data.Like everyone else programmer/developers uses svn a lot in their daily routine for keeping revisions of their source files alongs with any other documentaion.When you want to find a change a colleague made in a file or wonder when that change is made, you have to almost reap through all the revisions of the file and use the diff tools/viewers open each revision and see if change is there.It is hectic time consuming when there are many revisions on a file and if there are lot of changes per revision.So I created this small utility to find when the text/change you are looking is made in a file.

Set SvnExeLocation and TortoiseExeLocation in the config.xml before using the application.




Get the code and binaries from the link below.


Keywords:
svn subversion changes revisions head diff diffs log author message datetime
cvs repo repository file branch trunk tag history commit check-in check-out rev,svn changelist,svn changelog,svn change log message,svn changeset,svn change commit message,svn changes in revision,svn changes between revisions,svn changes since revision date,svn changes report.
svn changelist svn blame svn changelog

Saturday, July 3, 2010

Crystal Reports Windows Application - Failed to open the connection

Failed to open the connection.
Details: [Database Vendor Code: 4060 ]
Failed to open the connection.
temp_62a7065e-b077-44f0-8593-7dca04303f6a {7498BCDB-812A-4D53-B04E-9BD3E45EC6B6}.rpt
Details: [Database Vendor Code: 4060 ]
Stack Trace:
at CrystalDecisions.ReportAppServer.Controllers.RowsetControllerClass.CreateCursor(ISCRGroupPath GroupPath, RowsetMetaData MetaData, Int32 Reserved)
at CrystalDecisions.ReportAppServer.CrystalReportDataView.EnsureDataTableIsFilled()
at CrystalDecisions.ReportAppServer.CrystalReportDataView.get_DataView()
at CrystalDecisions.ReportAppServer.CrystalReportDataView.get_InternalCollection()
at CrystalDecisions.ReportAppServer.CrystalReportDataView.get_Count()


OK, the error above appeared out of no where and we had to spend hours and hours to figure out what is going on.

Let's get some info about the environment.

Dev database - where developers write code against and is used to design new reports.

QA database - where qa staff run the test cases in the app against.

Both databases are on the same server.

-Code sequence before issue
1.Change ReportDocument TableLogOnInfo using the app connection string.
2.Then load Report Viewer

Our requirement changed and wants to display report viewer if there are any records.
--Code sequence after issue happened
1.Check ReportDocument Rows Count and display message saying no records, and skip step2 and 3.
2.Change ReportDocument TableLogOnInfo using the app connection string.
3.Then load Report Viewer.

Problem here is step1 where row count is checked, when the check is done data is fetched from the database to which report is pointed at the design time as the connection is not updated until step2.

When QA staff runs the report at step1 database context changes to dev database where QA staff has no access to the data, for that matter they dont even have a login in the database which is why "Failed to open the connection." error is given.

GIST HERE IS UPDATE THE TABLELOGONINFO FOR REPORTS and SUBREPORTS WITH THE APPLiCATION INSTANCE CONNECTION STRING BEFORE QUERYING THE ROW COUNT ON THE REPORT DOCUMENT.

--SAMPLE CODE TO CHANGE THE CONNECTION INFO
Dim LogonInfo As New TableLogOnInfo

'-- Set the connection info
LogonInfo.ConnectionInfo.ServerName = GetServerName(connectionString)
LogonInfo.ConnectionInfo.DatabaseName = GetDatabaseName(connectionString)
If UsesIntegratedSecurity(connectionString) Then
LogonInfo.ConnectionInfo.IntegratedSecurity = True
Else
LogonInfo.ConnectionInfo.UserID = GetUserName(connectionString)
LogonInfo.ConnectionInfo.Password = GetUserPassword(connectionString)
End If

'--- Apply the connection info to each database table
For Each Table As Table In report.Database.Tables
Table.ApplyLogOnInfo(LogonInfo)
Next

'--- Also set connection info in the subreports
For Each subReport As ReportDocument In report.Subreports
For Each Table As Table In subReport.Database.Tables
Table.ApplyLogOnInfo(LogonInfo)
Next
Next

svnadmin dump - never finishes

Ok, here I am trying to separate a repository into two following svn documentation.I got to create a dump file then use svndumpfilter to create separate dump files for the projects I want and create repo's using those individual files.

With this in mind I started to work on it.Our repo is about 5 gigs in size.Command prompt in which I started the command says not responding after a while and never finishes dumping.I thougt it needed more time so let it go for the entire night with no success.After all these hours I
found out that dump is written to the console window.Changing that to output to file fixed the problem

Wrong
svadmin dump e:\repo e\repodump

Correct(if you want the dump file)
svadmin dump e:\repo >e\repodump

Finding the Owner( Launching Form)

Sometimes it is very useful to have reference to the form that launches another form.This is easily done by passing the owner in the form show method.But what if you have to change a lot in the existing code to get that.You can use windows api to get the owner.Lets say you have form1 and form2 in your app and form2 is launched from form1 and if we want to find the launcher of form2 which in our case is form1.This is what you do in form2.


<dllimport("user32", charset:="CharSet.Auto," exactspelling:="True)" setlasterror:="True,">_
Public Shared Function GetWindow(ByVal hwnd As IntPtr, ByVal uCmd As Integer) As Integer
End Function


--get the window now
Dim i As Integer
i = GetWindow(Me.Handle, 4)
Dim ctrl As Control = Form.FromHandle(i)