Monday, May 08, 2017

The equivalent to lambda expressions in Angular TypeScript (Javascript)

For filtering a list in C# we have :

var filteredList = List.Where(l => l.active);]

JS equivalent :

var filteredList = list.filter((l) => { return l.active == true; });


C# - Test for list values

var isListPopulated = List.Any( l => l.amount >= 0);

JS - Test for list values

var isListPopulated = list.filter((l) => { return l.amount >= 0; }).length > 0;


C# - Get first list item

var topItem = List.First( l => l.amount >= 0);

JS - Get first list item

var topItem = list.filter((l) => { return l.amount >= 0; })[0];

NB C# First() throws an exception if there is no match. As does the JS equivalent.



C# - Get first list item or null if none exist

var topItem = List.FirstOrDefault( l => l.amount >= 0);

JS - Get first list item or null if none exist (combo of the Any + First)

var filteredList = list.filter((l) => { return l.amount >= 0; });
var topItem = filteredList.length > 0 ? filteredList[0] : null;

Thursday, April 27, 2017

Resolving "Invalid column name" Exception

"System.Data.SqlClient.SqlException: Invalid column name 'Client_ClientId'."

A valid relationship to the Client entity model could not be determined. In our case, there were duplicate virtual references in the Client model (table) to the Document model (table).

The Document model had the following properties:

        public Nullable ClientId { get; set; }
        public virtual Client Client { get; set; }


However, the Client model had the following duplicate properties:

        public virtual ICollection ClientDocuments { get; set; }
        public virtual ICollection Documents { get; set; }

Removal of the duplicate eliminated the exception message.


Saturday, February 18, 2017

Angular2 rollup project errors

Receiving the following error message in the Task Runner Explorer window when rolling up an Angular2 app using Gulp (VisualStudio 2015) 

To fix the following error,
Unhandled promise rejection (rejection id: 1): Error: 'ChartsModule' is not exported by node_modules\ng2-charts\ng2-charts.js
Add the following lines

var charts_module_2 = require('./components/charts/charts');
exports.ChartsModule = charts_module_2.ChartsModule;

Inside of

\node_modules\ng2-charts\ng2-charts.js



To fix the following error,


Unhandled promise rejection (rejection id: 1): Error: 'MapsAPILoader' is not exported by node_modules\angular2-google-maps\core\index.js
Add the following lines:


var core_module_2 = require('./core.umd');
exports.MapsAPILoader = core_module_2.MapsAPILoader;

Inside of

node_modules/angular2-google-maps/core/index.js


For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module 



To fix the following error,
Unhandled promise rejection (rejection id: 1): Error: 'FileUploader' is not exported by node_modules\ng2-file-upload\index.js
Add the following lines

var file_uploader_module_2 = require('./components/file-upload/file-uploader.class');
exports.FileUploader = file_uploader_module_2.FileUploader;

Inside of

\ node_modules\ng2-file-upload\ng2-file-upload.js (2.2.1)


Tuesday, January 17, 2017

Angular2 issues with Vaadin Combo box. Using [ngModel] and (selected-item-changed) to set selected id value. not using [(ngModel)] selected-item-changed fires 3 times: 1) with 1st item in list - no matter what selection 2) same value as first 3) null value result: no selection is made. findings: item-value-path has wrong path. selected-item-changed fires 2 times: 1) with correctly selected value 2) null value result: no selection is made. findings: selected-item-changed handler was (re)setting the selected value to an invalid property, resulting in value being null a.selected-item-changed fires 2 times: 1.a) with correctly selected value 2.a) with 1st item in list result: wrong selection is made. b.selected-item-changed fires 2 times: 1.b) with previous selection 2.b) with correct value result: correct selection is made. c.selected-item-changed fires 1 time: 1.c) with correct value findings: item-value-path was using a key that could be null for selected item. selected-item-changed handler was (re)setting the selected value to correct value again, resulting in second change event firing. If key was valid and unique, selection was made correctly.

Wednesday, July 01, 2015

A Remote action is reporting a 'not found' exception.

The remote action is passing an incorrect number of parameters or one of the parameters is NULL. If the signature looks good, it is likely a null reference causing this error. Visualforce.remoting.Manager.invokeAction( 'traction_Page_Controller.submitForm', JSON.stringify(formData), function(result, event) { if (event.type !== 'exception') { console.log(result); } else { console.log('exception *!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!'); } } ); Visualforce Remoting Exception: Method 'submitForm' not found on controller traction_Page_Controller. Check spelling, method exists, and/or method is RemoteAction annotated

Tuesday, July 08, 2014

Adding, Removing, Re-Adding SQL accounts

Management Studio
[Server\Instance]>Security>Logins >> Add Login

SQL
SELECT SUSER_SID('<<username>>')

SELECT * FROM sys.server_principals SP where SID = <<user sid>>

Management Studio
[Server\Instance]>Databases>Object>Security>Users>User >> Delete User (Repeat as necessary)

[Server\Instance]>Security>Users>User >> Delete User

SQL
sp_droplogin <<username>>

SELECT SUSER_SID('<<username>>')

SELECT * FROM sys.server_principals SP where SID = <<user sid>>

Management Studio
[Server\Instance]>Security>Logins >> Add Login

Tuesday, March 18, 2014

ASP.Net Site loading slowly. MVC Site loading slowly. WCF service loading slowly. Cannot write to trace/error log files. File path is wrong

Thursday, November 28, 2013

App Pool service account password needs to be reset and account unlocked.

Cannot generate SSPI context.

Exception Details: System.Data.SqlClient.SqlException: Cannot generate SSPI context.
 
Source Error:             
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Cannot generate SSPI context.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6298249 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245 System.Data.SqlClient.TdsParser.TdsLogin(SqlLogin rec) +486 System.Data.SqlClient.SqlInternalConnectionTds.Login(ServerInfo server, Int64 timerExpire, String newPassword) +468 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject, Boolean withFailover) +324 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +6317999 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6318120 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6319384 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +81 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6322807 System.Data.SqlClient.SqlConnection.Open() +258 System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) +65 System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() +33 System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() +32 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +63 System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) +45 System.Linq.Queryable.Count(IQueryable`1 source) +310...

Tuesday, August 27, 2013

ODBC Driver Issue:  Progress OpenEdge 10.2B - error code 193


You are trying to create a 64bit ODBC connection using a 32bit driver and the 32bit driver does not appear in the 32bit ODBC connection manager (SysWOW64)

You need to add the following keys:


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers]
"Progress OpenEdge 10.2B driver"="Installed"


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\Progress OpenEdge 10.2B Driver]
"Driver"="[DLC]\\bin\\pgoe1025.dll"
"Setup"="[DLC]\\bin\\pgoe1025.dll"
"DriverODBCVer"="3.52"
"APILevel"="1"
"ConnectFunctions"="YYN"
"CPTimeout"="60"
"FileUsage"="0"
"SQLLevel"="0"
"UsageCount"="1"

[DLC] should refer to the 10.2B installation directory

Tuesday, January 08, 2013

System.ServiceModel.Security.SecurityNegotiationException: The caller was not authenticated by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed. Call is set to not-local, but is referring back to dev-services.

Thursday, December 20, 2012

Progress 4GL PF file

Progress 4GL PF file Local database -db C:\Data\databasename -inp 8192 -mmax 5120 -d ymd -T C:\TEMP TCP remote database -db databasename -N TCP -H localhost -inp 8192 -mmax 5120 -S portNumber -d ymd -T C:\TEMP

Friday, September 14, 2012

Database Administration

Load DF disabled Add -rx to shortcut

Thursday, August 30, 2012

SityDB Translog transaction type Excel formula =IF(AND(F3=0, G3=10, H3=0), "Credit Card", IF(AND(G3=10,F3=7, H3=0),"Failed CC Transaction",IF(AND(G3=1,F3=0, H3=0), "Coin",IF(AND(G3=1, F3=3, H3=0), "Cash Out",IF(AND(F3=0,G3=1, Where: F3 = tlRecordType G3 = tlPaymentType H3 = tlUserType

Friday, May 18, 2012

My SVN Ignore List *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store *.dll bin BIN Bin obj OBJ Obj *.pdb *.r PUB *.suo *.user *.Publish.xml

Friday, March 16, 2012

The RDBMS Version 10.2B of Progress OpenEdge does not use the "App Builder" (_ab.p). It is now the "Desktop" (_desk.p)

The OE Studio version uses the app builder.

Tuesday, January 10, 2012

Code: AV000
Message: APPROVED
Description: Successful communication attempt.

Code: AV400
Message: OPERATOR LOGIN FAILED
Description: Login credentials are wrong.

Code: AV401
Message: MAXIMUM ALLOWABLE LOGIN ATTEMPTS EXCEEDED
Description: Account is locked due to exceeded failed attempts. Account must be unlocked by Advam administrator.

Code: AV166
Message: STORED PAN ID IS REQUIRED
Description:

Code:
Message:
Description:

Code:
Message:
Description:

Code:
Message:
Description:

Code:
Message:
Description:

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)