Wednesday, August 31, 2011

When integrating with Chase Payemtech E-Xact Pay-Pages, I could not get the HMAC-MD5 hash to generate properly and match what their Hash Generator was producing. After reading up on HMAC (http://en.wikipedia.org/wiki/HMAC)

I ran some of their samples and found that what was being generated from the HMAC-MD5 was the same result as HMAC SHA1 and NOT what the wiki said should be produced for HMAC-MD5.

Solution? change the Pay-Page configuration to use SHA1 and use SHA1 to generate all the request and response validation hashes.

x_fp_hash

Tuesday, August 30, 2011

taskmanager windows mobile
force close an application on a windows mobile device
Settings > System > Memory > Running Programs

Select app and click
Or
Click

Wednesday, June 08, 2011

Collection of IF EXISTS statements for SQL

IF EXISTS (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Aparc_SpaceSensorHistory' AND COLUMN_NAME = 'RecordedOn')

IF EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_Aparc_ParkingSpace_Aparc_ParkingSpace]') AND parent_object_id = OBJECT_ID(N'[dbo].[Aparc_ParkingSpace]'))

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Aparc_ParkingSpace]') AND type in (N'U'))

SELECT * FROM sys.constraints

ALTER TABLE dbo.Aparc_SpaceSensorHistory
DROP CONSTRAINT DF_Aparc_SpaceSensorHistory_RecordedOn
END

ALTER TABLE dbo.Aparc_SpaceSensorHistory ADD
RecordDate datetime NOT NULL CONSTRAINT DF_Aparc_SpaceSensorHistory_RecordDate DEFAULT getdate()

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CorrectSpaceNumber]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[CorrectSpaceNumber]

IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Aparc_ParkingPlateHistory]') AND name = N'IX_Aparc_ParkingPlateHistory')
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Aparc_ParkingPlateHistory]') AND name = N'PK__Aparc_ParkingSpace')

if not exists (select name from sys.objects where type_desc = 'DEFAULT_CONSTRAINT' and name = 'DF_AID_AGENCY_STAFF_CSR')

IF EXISTS(SELECT * FROM SYS.OBJECTS WHERE type_desc = 'DEFAULT_CONSTRAINT' AND parent_object_id = OBJECT_ID(N'[dbo].[Aparc_ParkingPlate]' and name = 'DF_AID_AGENCY_STAFF_CSR'))

Tuesday, April 19, 2011

System.Data.Odbc.OdbcException: ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Failure getting record lock on a record from table PUB.#####.

Solution: Add the no-lock statement to each select statement.

SELECT * FROM PUB.##### WITH(NOLOCK)

Tuesday, April 12, 2011

I was getting a System.ObjectDisposedException when trying to serialize/remote a LINQ result set via a webservice. The actual data result was fine. The problem lay with the parent and child relationships generated by LINQ. Looping through each result and setting all the relationship objects to null stopped the exception, but that was not a solution (merely identified the source of the issue). The solution (provided to me by co-worker: Robert Blasutig), is to prevent LINQ from trying to load parent and child relationships automatically.

This is done by setting the DeferredLoadingEnabled property of the context to false.

To then have LINQ load parent/child objects later, you must specify which relationships to load with the following:

using (ClientDBDataContext clientCtx = new ClientDBDataContext(clientDbConnStr))
{
clientCtx.DeferredLoadingEnabled = false;

DataLoadOptions loadOptions = new DataLoadOptions();
loadOptions.LoadWith(dtAlias => dtAlias.ParentChildTableName);
clientCtx.LoadOptions = loadOptions;

...query...
}

FULL EXCEPTION:

System.InvalidOperationException: There was an error generating the XML document. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'DataContext accessed after Dispose.'.
at System.Data.Linq.DataContext.GetTable(Type type)
at System.Data.Linq.CommonDataServices.GetDataMemberQuery(MetaDataMember member, Expression[] keyValues)
at System.Data.Linq.CommonDataServices.DeferredSourceFactory`1.ExecuteKeyQuery(Object[] keyValues)
at System.Data.Linq.CommonDataServices.DeferredSourceFactory`1.Execute(Object instance)
at System.Data.Linq.CommonDataServices.DeferredSourceFactory`1.DeferredSource.GetEnumerator()
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
at System.Data.Linq.EntityRef`1.get_Entity()
at AparcSystems.AparcDataAccess.Aparc_PdmTariff.get_Aparc_EnfArea()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write25_Aparc_PdmTariff(String n, String ns, Aparc_PdmTariff o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write57_ArrayOfAparc_PdmTariff(Object o)
at Microsoft.Xml.Serialization.GeneratedAssembly.ListOfAparc_PdmTariffSerializer.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
at System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
at System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.Invoke()

Monday, April 11, 2011

"DoInsertLogbookRecord"
"DoInsertTransLogRecord"

"Transaction context in use by another session"

Trigger code updates a table in a database in local instance. Does not require (ie CANNOT HAVE) reference to [server\instance] name in target.

Monday, January 17, 2011