ExtJs source control package strategy for a utility library

So, after (re)reading the sencha docs and forums a couple of times I have come up with an alternate strategy for maintaining a utility library as a package... Not sure if it will not change at some point but so far it seems to be ok-ish...

Anyway, the requirements were:

  • it should be possible to share the lib between apps / projects (obviously)
  • the lib should have its own source control storage without having to use workspaces and such
  • in should be possible to pack it and deliver as a package in the future (not sure it it will ever be the case though ;)
  • It should be ready for the ExtJs 6 universal app usage
So what i did was:
  • I created a package within one of my apps and moved it to a separate repo
  • I created 3 subfolders under the src folder: core, classic, and modern; they will hold the core code as well as the ui for both modes
  • in the app's packages folder I created a Junction to the new source controlled package folder
  • in the app.json I added my app in the requires array - at this stage it is ok to reference the classes through the PackageName (in my case gm) namespace

So far it looks like the package buids-in nicely into the consumer app and at the same time it is independently source controlled which were my primary concerns.
There are some problems building the package itself as it is not a part of an app or a workspace. I guess it can be simply copied over to a temp app and then built as required. Not too fancy indeed, though at this stage I have no drive to investigate it further.

[Edit]
  1. As of ExtJs 6, i leaned towards using universal apps. therefore the code organisation changes a bit and the code goes to src, modern and classic folders respectively
  2. When requiring a package class in the generic code (not toolkit specific) then there must be package equivalents for a required class for both toolkits - otherewise building will fail for the code not implemented for a particular toolkit
  3. And finally, made the package build as expected - instead of simply drilling down to the packages/local/packageName and running sencha package build (that throws errors related to missing Ext classes), the command should include the sdk param, so the cmd knows where ExtJs stuff actually is (obviously not in the default location in my case ;) 

Jasmine test runner for ExtJs

I have been thinking for a while on plugging Jasmine into ExtJs apps in an easy way. So here it goes an ExtJs TestRunner for Jasmine. This is more a PoC than a completed module, but so far it proved itself to be working as expected.

It can replace the app's viewport:

or work side by side:

The usage is rather simple:

//get the query params, so can dynamically adjust where the tests will be executed
//this may be handy if the tests need ui for example
var query = Ext.Object.fromQueryString(window.location.search),
    testRunnerCfg,
    tests = [
        'Jasmine.test.Simple',
        'Jasmine.test.Async'
    ];

//check if should handle the normal startup or kick in with the tests mode
if(Jasmine.util.TestRunner.isInTestMode()){

    //by default the test runner creates its own viewport that is displayed instead of the app
    //it is possible to customise this and display the jasmine output on the side or actually in any container

    //the default will run test runner with the standard output generated instead of the app
    testRunnerCfg = {
        tests: tests
    };

    //display tests on the side
    if(query.hasOwnProperty('testsonside') && query['testsonside']){
        this.viewport = Ext.create('Ext.container.Viewport', {
            layout: 'border',
            items: [
                {
                    xtype: 'panel',
                    region: 'center',
                    layout: 'fit',
                    items: [
                        Ext.create('Jasmine.view.main.Main')
                    ]
                },
                {
                    xtype: 'panel',
                    region: 'south',
                    height: 300,
                    html: '
', overflowY: true, split: true, title: 'Jasmine output' } ] }); testRunnerCfg.outputContainer = 'jasmine_output'; } Ext.create('Jasmine.util.TestRunner', testRunnerCfg); } else { //normal app startup //create the app's viewport this.viewport = Ext.create('Ext.container.Viewport', { layout: 'fit', items: [ Ext.create('Jasmine.view.main.Main') ] }); }

for details see the example app on github

Installing manifold traditional topology tools without the built in system account

Manifold traditional topology tools come in as an msi package. In some scenarios, even though one has an admin account, it will not be possible to install the topology tools. This thread mentions that this is because a built in admin account is requires to complete the installation process successfully.

A workaround is to launch a cmd as an Administrator and from there execute the:

msiexec /a Manifold-Traditional-Topology-Tools-1.0.0.0-x64.msi

That should do the trick.

Access pgsql x64 from manifold x32/x64 - both installed on win 64

Scenario:

  • windows server x64
  • manifold 8.x x64
  • pgsql 9.x x64
In order to allow manifold x64 to connect to the db server one needs to:
  • install Microsoft Visual C++ 2013 Redistributable Package x64 (actually pgsql will not even start without it)
  • add pgsqls bin to the PATH variable or
  • copy intl.dll, libeay32.dll, libiconv.dll, libpq.dll, ssleay32.dll to manifold x64 installation folder
All good to go until one needs to connect to pgsql from manifold x32... In order to do that:
  • install Microsoft Visual C++ 2013 Redistributable Package x32 and
  • copy intl.dll, libeay32.dll, libiconv.dll, libpq.dll, ssleay32.dll to manifold x32 installation folder
Now you should be able to connect to your x64 pgsql from both manifold versions

SqlServer updatable views for user base data access encapsulation

Recently there was a disscussion at the georeference.org on how to provide a user / user group SQL SERVER data access encapsulation in manifold (and pretty much in any other client) so different clients modify the very same data source but do not have the access to other users data.

The answer was - the updatable views:

https://msdn.microsoft.com/en-us/library/ms180800(v=sql.110).aspx#Restrictions

https://msdn.microsoft.com/en-us/library/ms187956(v=sql.110).aspx

When a view is created with the 'WITH VIEW_METADATA' then it becomes update able straight away but there are some restrictions (see links above). The other option is to use 'INSTEAD OF' triggers. It is way more flexible, though one needs to create the triggers of course ;)

In manifold, due to the way it inserts the data - first goes a geom with nulls for all the fields, then goes the data collected through the 'instant data' window or the direct object / table edit - objects are not populated with the data needed to filter the dataset and therefore are not editable / delete able until the data is fixed on the DB side and a drawing / table is refreshed. This pretty much is a show stopper with the 'WITH VIEW_METADATA' approach .

Luckily there are the 'INSTEAD OF' triggers. The most important is  the insert trigger - this is the place the fields used for view filtering are populated. One can then opt for a full set of the 'INSTEAD OF' triggers or use a mixed approach - triggers with the view metadata.

A longer version with a complete set of the 'INSTEAD OF' triggers:

--cleanup, cleanup, everybody cleanup
-------------------------------------
IF OBJECT_ID('dbo.vwTest_TypeX', 'V') IS NOT NULL
	DROP VIEW [dbo].[vwTest_TypeX];
GO

IF OBJECT_ID('dbo.vwTest_TypeY', 'V') IS NOT NULL
	DROP VIEW [dbo].[vwTest_TypeY];
GO

IF OBJECT_ID('dbo.tblTest', 'U') IS NOT NULL
	DROP TABLE [dbo].[tblTest];
GO
-------------------------------------


--create test table
-------------------------------------
CREATE TABLE [dbo].[tblTest](
	[OID] [int] IDENTITY(1,1) NOT NULL,
	[Version] [int] NULL,
	[Type] [nvarchar](1) NULL, --Type is used to handle user / user group data encapsulation
	[Geometry] [geometry] NULL,
PRIMARY KEY CLUSTERED 
(
	[OID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
-------------------------------------


--views that will be updatable through the INSTEAD OF triggers
-------------------------------------

--View for Team X
CREATE VIEW [dbo].[vwTest_TypeX] as
SELECT
	[OID],
	[Version],
	--Do not select [Type]! Type is used to provide user / user group data encapsulation and should
	--not be handled by the users but rather automaticaly!
	[Geometry]
FROM
	[dbo].[tblTest]

	--Note:
	--can do joins, aggregates and such

WHERE
	[Type] = 'X';

GO

--View for Team Y
CREATE VIEW [dbo].[vwTest_TypeY] as
SELECT
	[OID],
	[Version],
	--Do not select [Type]! Type is used to provide user / user group data encapsulation and should
	--not be handled by the users but rather automaticaly!
	[Geometry]
FROM
	[dbo].[tblTest]

	--Note:
	--can do joins, aggregates and such

WHERE
	[Type] = 'Y';

GO
-------------------------------------


--create INSTEAD OF triggers
-------------------------------------

--team X
-------------------------------------

--instead of insert
CREATE TRIGGER [dbo].[vwTest_TypeX_Insert]
ON [dbo].[vwTest_TypeX]
INSTEAD OF INSERT AS
BEGIN
	--Note:
	--need to do an insert to the source table not the view, as the vie is supposed to hide the
	--[Type] column from users;
	--if this was not the case could interact with the view directly as in update / delete triggers
	INSERT INTO [dbo].[tblTest] ([Version], [Type], [Geometry])
	SELECT
		[Version],
		'X', --need to apply the type or other criteria used by the view to filter out the
		     --subset of the data
		[Geometry]
	FROM
		INSERTED; 

	--Note:
	--can modify other tables and such

	IF @@ERROR<>0
		RAISERROR('Failed on inserting into [vwTest_TypeX].', 16, 1);
END

GO

--insetad of delete
CREATE TRIGGER [dbo].[vwTest_TypeX_Delete]
ON [dbo].[vwTest_TypeX]
INSTEAD OF DELETE AS
BEGIN
	DELETE FROM 
		[dbo].[vwTest_TypeX] 
	WHERE
		[OID] in (SELECT [OID] FROM DELETED);
       
	--Note:
	--can modify other tables and such

    IF @@ERROR<>0
        RAISERROR('Failed on deleting from [vwTest_TypeX].', 16, 1);
END
GO

--instead of update
CREATE TRIGGER [dbo].[vwTest_TypeX_Update]
ON [dbo].[vwTest_TypeX]
INSTEAD OF UPDATE AS
BEGIN
    IF UPDATE([OID])
            RAISERROR('Cannot update [OID] on [vwTest_TypeX].', 16, 1);
      
	UPDATE
		[dbo].[vwTest_TypeX]
	SET
		[Version] = ins.[Version],
		[Geometry] = ins.[Geometry]
	FROM
		INSERTED ins join [dbo].[vwTest_TypeX] tbl on ins.OID = tbl.[OID] 
      
	--Note:
	--can modify other tables and such

	IF @@ERROR<>0
		RAISERROR('Failed on updating [vwTest_TypeX].', 16, 1);
END
GO
-------------------------------------

--team Y
-------------------------------------
--instead of insert
CREATE TRIGGER [dbo].[vwTest_TypeY_Insert]
ON [dbo].[vwTest_TypeY]
INSTEAD OF INSERT AS
BEGIN
	--Note:
	--need to do an insert to the source table not the view, as the vie is supposed to hide the [Type] column from users;
	--if this was not the case could interact with the view directly as in update / delete triggers
	INSERT INTO [dbo].[tblTest] ([Version], [Type], [Geometry])
	SELECT
		[Version],
		'Y', --need to apply the type or other criteria used by the view to filter out the
		     --subset of the data
		[Geometry]
	FROM
		INSERTED; 

	--Note:
	--can modify other tables and such

	IF @@ERROR<>0
		RAISERROR('Failed on inserting into [vwTest_TypeY].', 16, 1);
END

GO

--insetad of delete
CREATE TRIGGER [dbo].[vwTest_TypeY_Delete]
ON [dbo].[vwTest_TypeY]
INSTEAD OF DELETE AS
BEGIN
	DELETE FROM 
		[dbo].[vwTest_TypeY] 
	WHERE
		[OID] in (SELECT [OID] FROM DELETED);
       
	--Note:
	--can modify other tables and such

    IF @@ERROR<>0
        RAISERROR('Failed on deleting from [vwTest_TypeY].', 16, 1);
END
GO

--instead of update
CREATE TRIGGER [dbo].[vwTest_TypeY_Update]
ON [dbo].[vwTest_TypeY]
INSTEAD OF UPDATE AS
BEGIN
    IF UPDATE([OID])
        RAISERROR('Cannot update [OID] on [vwTest_TypeY].', 16, 1);
      
	UPDATE
		[dbo].[vwTest_TypeY]
	SET
		[Version] = ins.[Version],
		[Geometry] = ins.[Geometry]
	FROM
		INSERTED ins join [dbo].[vwTest_TypeY] tbl on ins.OID = tbl.[OID] 
      
	--Note:
	--can modify other tables and such

	IF @@ERROR<>0
		RAISERROR('Failed on updating [vwTest_TypeY].', 16, 1);
END
GO
-------------------------------------


And a shorter version that mixes the 'WITH VIEW_METADATA' and only the 'INSTEAD OF INSERT' trigger

--cleanup, cleanup, everybody cleanup
-------------------------------------
IF OBJECT_ID('dbo.vwTest_TypeX', 'V') IS NOT NULL
	DROP VIEW [dbo].[vwTest_TypeX];
GO

IF OBJECT_ID('dbo.vwTest_TypeY', 'V') IS NOT NULL
	DROP VIEW [dbo].[vwTest_TypeY];
GO

IF OBJECT_ID('dbo.tblTest', 'U') IS NOT NULL
	DROP TABLE [dbo].[tblTest];
GO
-------------------------------------


--create test table
-------------------------------------
CREATE TABLE [dbo].[tblTest](
	[OID] [int] IDENTITY(1,1) NOT NULL,
	[Version] [int] NULL,
	[Type] [nvarchar](1) NULL, --Type is used to handle user / user group data encapsulation
	[Geometry] [geometry] NULL,
PRIMARY KEY CLUSTERED 
(
	[OID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
-------------------------------------


--views that will be updatable through the INSTEAD OF triggers
-------------------------------------

--View for Team X
CREATE VIEW [dbo].[vwTest_TypeX]
WITH VIEW_METADATA
AS
SELECT
	[OID],
	[Version],
	--Do not select [Type]! Type is used to provide user / user group data encapsulation and should not be handled by the users but rather automaticaly!
	[Geometry]
FROM
	[dbo].[tblTest]

	--Note:
	--can do joins, aggregates and such

WHERE
	[Type] = 'X';

GO

--View for Team Y
CREATE VIEW [dbo].[vwTest_TypeY]
WITH VIEW_METADATA
AS
SELECT
	[OID],
	[Version],
	--Do not select [Type]! Type is used to provide user / user group data encapsulation and should not be handled by the users but rather automaticaly!
	[Geometry]
FROM
	[dbo].[tblTest]

	--Note:
	--can do joins, aggregates and such

WHERE
	[Type] = 'Y';

GO
-------------------------------------


--create INSTEAD OF triggers
-------------------------------------

--team X
-------------------------------------

--instead of insert
CREATE TRIGGER [dbo].[vwTest_TypeX_Insert]
ON [dbo].[vwTest_TypeX]
INSTEAD OF INSERT AS
BEGIN
	--Note:
	--need to do an insert to the source table not the view, as the vie is supposed to hide the [Type] column from users;
	--if this was not the case could interact with the view directly as in update / delete triggers
	INSERT INTO [dbo].[tblTest] ([Version], [Type], [Geometry])
	SELECT
		[Version],
		'X', --need to apply the type or other criteria used by the view to filter out the subset of the data
		[Geometry]
	FROM
		INSERTED; 

	--Note:
	--can modify other tables and such

	IF @@ERROR<>0
		RAISERROR('Failed on inserting into [vwTest_TypeX].', 16, 1);
END

GO
-------------------------------------

--team Y
-------------------------------------
--instead of insert
CREATE TRIGGER [dbo].[vwTest_TypeY_Insert]
ON [dbo].[vwTest_TypeY]
INSTEAD OF INSERT AS
BEGIN
	--Note:
	--need to do an insert to the source table not the view, as the vie is supposed to hide the [Type] column from users;
	--if this was not the case could interact with the view directly as in update / delete triggers
	INSERT INTO [dbo].[tblTest] ([Version], [Type], [Geometry])
	SELECT
		[Version],
		'Y', --need to apply the type or other criteria used by the view to filter out the subset of the data
		[Geometry]
	FROM
		INSERTED; 

	--Note:
	--can modify other tables and such

	IF @@ERROR<>0
		RAISERROR('Failed on inserting into [vwTest_TypeY].', 16, 1);
END

GO
-------------------------------------